From 92e3069e0b56a3bb5722ab321d41385daa493207 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:08:38 -0700 Subject: [PATCH 01/19] add pry for debugging --- Gemfile | 1 + Gemfile.lock | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index b8121c7ee5..771ddb6ce7 100644 --- a/Gemfile +++ b/Gemfile @@ -57,4 +57,5 @@ group :development, :test do gem 'cucumber-rails-training-wheels' gem 'database_cleaner' gem 'capybara' + gem 'pry' end diff --git a/Gemfile.lock b/Gemfile.lock index 64eb36cc1c..26794b0ec3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: RedCloth (4.2.9) abstract (1.0.0) @@ -87,6 +87,8 @@ GEM i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) + method_source (0.6.7) + ruby_parser (>= 2.3.1) mime-types (1.19) mini_magick (1.3.3) subexec (~> 0.0.4) @@ -94,6 +96,11 @@ GEM nokogiri (1.5.5) pg (0.14.1) polyglot (0.3.3) + pry (0.9.7.4) + coderay (~> 0.9.8) + method_source (~> 0.6.7) + ruby_parser (>= 2.3.1) + slop (~> 2.1.0) rack (1.2.5) rack-mount (0.6.14) rack (>= 1.0.0) @@ -141,6 +148,8 @@ GEM ruby-debug-base19 (>= 0.11.19) ruby_core_source (0.1.5) archive-tar-minitar (>= 0.5.2) + ruby_parser (3.8.1) + sexp_processor (~> 4.1) rubypants (0.2.0) rubyzip (0.9.9) selenium-webdriver (2.25.0) @@ -148,10 +157,12 @@ GEM libwebsocket (~> 0.1.3) multi_json (~> 1.0) rubyzip + sexp_processor (4.7.0) simplecov (0.6.4) multi_json (~> 1.0) simplecov-html (~> 0.5.3) simplecov-html (0.5.3) + slop (2.1.0) sqlite3 (1.3.6) subexec (0.0.4) thin (1.5.0) @@ -193,6 +204,7 @@ DEPENDENCIES kaminari mini_magick (~> 1.3.3) pg + pry rails (~> 3.0.10) rake (~> 0.9.2) recaptcha @@ -205,3 +217,6 @@ DEPENDENCIES thin uuidtools (~> 2.1.1) webrat + +BUNDLED WITH + 1.11.2 From ad074c3eaa3cf61cd021d89b9ee6e0aa3d333110 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:22:19 -0700 Subject: [PATCH 02/19] passing for Successfully add a category Scenario --- features/manage_categories.feature | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 features/manage_categories.feature diff --git a/features/manage_categories.feature b/features/manage_categories.feature new file mode 100644 index 0000000000..2c035e3e4a --- /dev/null +++ b/features/manage_categories.feature @@ -0,0 +1,17 @@ +Feature: Manage Categories + As a blog administrator + In order to organize my posts + I want to be able to add and edit categories + + Background: + Given the blog is set up + And I am logged into the admin panel + And there are no categories + + Scenario: Successfully add a category + When I follow "Categories" + And I fill in "Name" with "Test" + And I press "Save" + Then I should see "Category was successfully saved." + And I should see "Test" + And I should have 1 category From d10b0aa7ec288e743f31bab60c1eb32162826c80 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:22:53 -0700 Subject: [PATCH 03/19] run rake for test --- db/db_development | Bin 0 -> 143360 bytes db/db_test | Bin 0 -> 159744 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 db/db_development create mode 100644 db/db_test diff --git a/db/db_development b/db/db_development new file mode 100644 index 0000000000000000000000000000000000000000..627ced305e5670922577041f54c51d71a3845e7f GIT binary patch literal 143360 zcmeI54Qw3Qeb{GqXSw7`GfzAnwMX+P4ylu=wQkA%{-95HM@bY#9YygdQj}z$*R#9B z-8s$f?9I&bL$M7k@6y_h(-=u$w60sYLD9Ns8y8M$G|fki=G#uvw5U_0X@R6gE{As-2?|H8?D(Cb+uEb~=abr~Sc;7x~5%Gq7eFJDRRq zIa4c@ZL8<&ShtxyzSPpDQ)dn|W13i}Tc~mVv_CjG$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~lT1ZU_`HPA l2B^%8P?;X4GUcZ-IYec`M`c`~GUlZ+>KXE$9)b1${{te`$p!!b literal 0 HcmV?d00001 diff --git a/db/db_test b/db/db_test new file mode 100644 index 0000000000000000000000000000000000000000..d04839592d2fe65641c9537533285a4e11e1121a GIT binary patch literal 159744 zcmeI53v?UVd6+T4fFMB3j3|kMv=qf5xmpUVg@`8sa96uaQ4~onMNt&Rmv@aF07GJ= z!DBH4l2F#$fV*zjwd1%>>eISz>gJ@4d)(Tsow^UFId1DV?K*Yc9y>{s_MEs)V;>*K zwNs~OYqx3td+~lPL27l5wEA(#{~yeKfA{`(?w!G%d-KM;qRZlDI-8Vq(PubfU>L*m zqG&KMXAK6!DEyZ{gK)r>zkp_Hj@ukU9IijInTcoNr^L@G;iueN+*SLBY!|FwvR<(C zbbYL=+Z<-Uz+NnKrdGgZyv^ZSrG%TJQR^r3r+`{to%=D7DxHNZda%o+BVR~JhytRCN zZUMqxn_gHJ7p}wqt@-(<#Nk*vrOPQjLINsqxFu)dY&qK6(@y=k#c}>TQy8Qf%w*G> ziYjZ7tg@BRwT7>K_1SE2B{?mfs!f3;Od_j2=PaB(W^oJ*Fna@a$(Cb0-a4T}u~4O` ztPYFYQZ|;5vgf>kfD^KmQetvSO3F3&GPHPAN!@A6ZCuu3StUanRK1%s*=un;=U@uGN-8ezQW420 zsVyy%PDP}wuEbOss)U|8S}MZa!sY2Tak#DLVe$HcI81|(!c}7#b{5VYu{azKX0N{p ziljt6_BP-l4u>LBlUhxi&SjhHHkOqoU5-a2eOQdck**|VrzQZ8kp>>pmK=#mu>>@D zphDPZs;7>$q*8S+2PsjhI*{VgdUO_8-r^X6RIeAQRQ=SXBQy}IdO8%R<`(2E%ySmU z=qR(dO0$tl>&m7QlV~?o_l2*|N}b!GGSj*v%4u@8wmTp_R*O1=)42?(z=o`qEwAMLO+-(zu1LpBE5 zWTV<*%dyz^%R)6sbMiHA&NoCG?LXf)Qhg@YV%ns zrzg_cCeP7yJYVcjA*8$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8cZJSm+my3!Ko!|3Ch1{zt;M`S0=n4d(mb;=j)SCjS-w zpTKPYv%>H5zrz1@{uBJq!)(96-{m!473rph0o%J+V%yf0DZd66pj`-lpKH>e7&Qx#mJYJ8QdzzS9V zTU7a$sq)^W%Ckh3`vy_L@FG>A>r@37s2aaURbZYf{|i+4u2SWlqslW&m3xM$@$eO@ zLeo?QFHMOEMuRsKn;e9u$meU2*6vsAe+5)}wPLsjT$s)7?#jfbfUgsAcdsq&3e zeK0{S#fU4kWs>b`N3Oq)Y{}ffelT>*fRC!KN z?U&DLS&$e zNWYm#A4{ayM5M>qWjbbs`9FF7?_hq`08jnDEPTxV3Hz(|7wtj2-Fme9?e5?0{$lr= z=8u|n^Rju&%o=UX51DT;p9Syud6x({9i8v@c%qa29{U>hd(0&x8EH$_Cd5&Xd(?LF zc>6t9;e{{EhZV+PBJb~ursMeuaVV;!q-s%32nz=EBpD>QXn=Hz8jlKsIla&T-0|pMRsCWF1e+(C2eEbt*p$d zJ5ktmo@(F1jx@89-&n5O(7rAi2;P(uiNYIC#F9&DR0(Xyk}+jbr74rW;_qy%`YT(_ zLvXU&JnRD>YP*@e@5bGQJnp&rDDJs>v~wHm?ZgI;>|=vMdmDr|451Bftld!NW|uPY znOzk+m#OGXn06r3EB@HE>zPdW~=dc(?bL$naQZMWsUsztq!ac?+F{u`rTnMrJu;Hy{e0-jsaOjuuEyH@EK zNw4@0Oq3G&`P4#MS`CnXHPM*D4WF8qR(F8OLI7$;tED~#R|`lT`rR%1e|cv+zPfXM zYU|=fo37}pJR#02sXLm@ycHNI?o-q;Tw@$*m`#O29eIE}mtHwSa z`}jw%kAI?b8$8>I4L-h)4UV+8L3lel+92BCqi2Ido!g+;i46|!V}obf+aSD-A8inA z@X@ou)1BL3e Date: Mon, 28 Mar 2016 15:25:27 -0700 Subject: [PATCH 04/19] add ternary operator to the new_or_edit method for @categories to handle cases of new/no id --- app/controllers/admin/categories_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index b7026f8f29..310f376720 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -1,13 +1,14 @@ +require 'pry' class Admin::CategoriesController < Admin::BaseController cache_sweeper :blog_sweeper def index; redirect_to :action => 'new' ; end def edit; new_or_edit; end - def new + def new respond_to do |format| format.html { new_or_edit } - format.js { + format.js { @category = Category.new } end @@ -25,12 +26,12 @@ def destroy def new_or_edit @categories = Category.find(:all) - @category = Category.find(params[:id]) + @category = params[:id] ? Category.find(params[:id]) : Category.new @category.attributes = params[:category] if request.post? respond_to do |format| format.html { save_category } - format.js do + format.js do @category.save @article = Article.new @article.categories << @category From 73056b27d2d6baf99119256e0046a41fbe1b3afa Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:26:09 -0700 Subject: [PATCH 05/19] define no cateories and num of categories --- features/step_definitions/web_steps.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 6315105872..a5d55c7217 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -18,6 +18,13 @@ # * http://elabs.se/blog/15-you-re-cuking-it-wrong # +Given /^there are no categories$/ do + Category.delete_all +end + +Then /^I should have (\d+) category$/ do |num| + Category.all.count == num.to_i +end require 'uri' require 'cgi' @@ -250,7 +257,7 @@ def with_scope(locator) end end end - + Then /^(?:|I )should be on (.+)$/ do |page_name| current_path = URI.parse(current_url).path if current_path.respond_to? :should @@ -264,8 +271,8 @@ def with_scope(locator) query = URI.parse(current_url).query actual_params = query ? CGI.parse(query) : {} expected_params = {} - expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} - + expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} + if actual_params.respond_to? :should actual_params.should == expected_params else From ae5c9d5c3b3825d0fdf9deaeba9ccb1b64705693 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:36:51 -0700 Subject: [PATCH 06/19] some js files updated apparently --- public/javascripts/ckeditor/config.bak | 2 +- public/javascripts/ckeditor/config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 public/javascripts/ckeditor/config.bak mode change 100644 => 100755 public/javascripts/ckeditor/config.js diff --git a/public/javascripts/ckeditor/config.bak b/public/javascripts/ckeditor/config.bak old mode 100644 new mode 100755 index 187db086f2..492800fd66 --- a/public/javascripts/ckeditor/config.bak +++ b/public/javascripts/ckeditor/config.bak @@ -8,7 +8,7 @@ CKEDITOR.editorConfig = function( config ) config.PreserveSessionOnFileBrowser = true; // Define changes to default configuration here. For example: //config.language = ''; - config.uiColor = '#E0ECFF'; + config.uiColor = '#eee'; config.toolbar = 'Basic'; config.entities_greek = false; config.entities_latin = false; diff --git a/public/javascripts/ckeditor/config.js b/public/javascripts/ckeditor/config.js old mode 100644 new mode 100755 index 187db086f2..492800fd66 --- a/public/javascripts/ckeditor/config.js +++ b/public/javascripts/ckeditor/config.js @@ -8,7 +8,7 @@ CKEDITOR.editorConfig = function( config ) config.PreserveSessionOnFileBrowser = true; // Define changes to default configuration here. For example: //config.language = ''; - config.uiColor = '#E0ECFF'; + config.uiColor = '#eee'; config.toolbar = 'Basic'; config.entities_greek = false; config.entities_latin = false; From a7a953746e18aec03bee4fd7995b1a1a1db73ea2 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:58:57 -0700 Subject: [PATCH 07/19] add definitions for creating n num of categories --- features/step_definitions/web_steps.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index a5d55c7217..2282fffb23 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -26,6 +26,12 @@ Category.all.count == num.to_i end +Given /^I have (\d+) category$/ do |num| + num.to_i.times do + Category.create(name:"Test #{num}") + end +end + require 'uri' require 'cgi' require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) From c57479e26ed56ec8e38c33112ad20e1bc3aba10b Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 15:59:27 -0700 Subject: [PATCH 08/19] bdd for successfully editing a category --- db/db_development | Bin 143360 -> 143360 bytes db/db_test | Bin 159744 -> 172032 bytes features/manage_categories.feature | 12 +++++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/db/db_development b/db/db_development index 627ced305e5670922577041f54c51d71a3845e7f..9cfaa678ddce52a4358302dee9c4d2b8b81789c1 100644 GIT binary patch delta 61 zcmV-D0K)%(;0S==2#^~Au#p@?0kE-Pr#}S)59<%rvk?%<50lkT6A=Ia022WS02K)v T4GjQdY+-1F`A@g`PXPzugQyeg delta 61 zcmV-D0K)%(;0S==2#^~AuaO)>0k5%Or#}S%59klovk?%<50lkT6A=~x2ml)i8vp_Ml_P2F_rbk4cW<;4!|&{b9! zgFqUA-@{Hp&`lJx2WpTvA?O}OusQ^RizKLEm!A24{)3L+&-e8?eBSR$L#rI!M{ds!eGnbq=xWM6eoG?6 z+Yb`0HtQEH$s1G=^q8{LryMFZZ)!*7gCY4G)qVQQ zXcA@uW*jCC6Z6d&OcZ7mW&~!~HxZa2n86d{Ht(|2fvqG{15u?WyBf6dKZo{nr&rrl z#AmTB%Hk|<@^`$(bG*~~Xt~xSD{lTW56$Q1eRIHQ7%z>gQ8cdT@AYT;x}MNaX|J`- zz3yO4WA-ZYy@Py9$ae+#7LjiOBoDF-k^@-+$$~6`WIz@`=0VaRb0D)IGaxCDX^<(9 zBuD~e5@Z5o93&1B0~u?R3tK-)4Ro`->~h#8@5oz>ohhN96~CY&3M!zWJW5=K$@yjp ZCJVC&lYv?A%{)vRW)5Z+W~OcauzwM(0#*P3 delta 132 zcmV-~0DJ#{zzTri36L8FB>(^bCy^jO0VT0uT0a3nle<4e0Yid7wm<;{a1H|x@c;k- z04ERo5B3l7w-PV{-w(I(zX1;*k{|>MLjkS;57ZB(4}zBt-~oWM5fC5&0xCn7f$ae+ mx7%?7DGs9qz#yjt5CTvL0u1Z`4F(MCvk?&B47coT0u%#3q$l+N diff --git a/features/manage_categories.feature b/features/manage_categories.feature index 2c035e3e4a..2228c881c4 100644 --- a/features/manage_categories.feature +++ b/features/manage_categories.feature @@ -6,12 +6,22 @@ Feature: Manage Categories Background: Given the blog is set up And I am logged into the admin panel - And there are no categories Scenario: Successfully add a category + Given there are no categories When I follow "Categories" And I fill in "Name" with "Test" And I press "Save" Then I should see "Category was successfully saved." And I should see "Test" And I should have 1 category + + Scenario: Successfully edit a category + Given I have 1 category + When I follow "Categories" + When I follow "Edit" + And I fill in "Name" with "Another Test" + And I press "Save" + Then I should see "Category was successfully saved." + And I should see "Another Test" + And I should have 1 category From 2481cb74bebc1de2a21f88e4d812a08dce8f813f Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Mon, 28 Mar 2016 18:21:05 -0700 Subject: [PATCH 09/19] rspec test for categories view --- db/db_test | Bin 172032 -> 143360 bytes .../admin/categories_controller_spec.rb | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/db/db_test b/db/db_test index c409e77ae0f20497273c8a869d20dff4f1aa5c86..8da5251a77d9197104e976e570e9a31743792d38 100644 GIT binary patch delta 147 zcmZoTz}4`8V}cYLLpK8hgYrZLJ0^zijR{NSH?s&Z39!6l;D5JSP~Zu_kN_jIDq~4% zMM->GW==_JQ8CM+1qzEU7%bW#u;_xorVT6&n^_M0(cg4|MPNBg0iyw&$HT(!#lU}s ue<^<@zZcLfD}E+jmg$9$7v5_+|_C+iXy2cDT<=_+FfG@z>pXb zuf+`bknK&NwcB;=IJT4cq_*oiIc~E(+uDuo+HIWXIIUZ^>%?_?>^ODmbL=*aeSB=! zPMjXsZqoku;{93x*kECO2T>~6%$p#%^YD^mU&tb z7>3FP46;ZG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mcj>braT0nB~fRNbtg9LuFX$8rJ#z@Y$fW&q{NY3pC2`s5< z1<7NLk(_M-$)g8^WMDr?V1-L7NctKh5n4dfdq7Ce><0-fIA{gQ>BdO9TR`&20UZAvwMuB=9<@R*)QRjHI&#Bu5Si3BMmC@OGY7keC}IF|~lC z<_VJd{~5!38U9=F z#{U=jQ*b24OaYHi$NO_-t^cc^h1A#s-%f*x>E@HVD&iv_Z7NLuZ5k9|Jzz 'index' end + describe "test_new" do + before(:each) do + get :new + end + + it "should render the new template" do + get "new" + expect(subject).to render_template :new + end + end + describe "test_edit" do before(:each) do get :edit, :id => Factory(:category).id @@ -48,7 +59,7 @@ it 'should render destroy template' do assert_response :success - assert_template 'destroy' + assert_template 'destroy' end end @@ -62,5 +73,5 @@ assert_raise(ActiveRecord::RecordNotFound) { Category.find(test_id) } end - + end From fbcf076d75dca21b8bd9fc99984a3689c3ec22d7 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 08:55:02 -0700 Subject: [PATCH 10/19] remove extra before each new --- spec/controllers/admin/categories_controller_spec.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spec/controllers/admin/categories_controller_spec.rb b/spec/controllers/admin/categories_controller_spec.rb index b5338434d7..fa4df8e80a 100644 --- a/spec/controllers/admin/categories_controller_spec.rb +++ b/spec/controllers/admin/categories_controller_spec.rb @@ -16,11 +16,6 @@ assert_response :redirect, :action => 'index' end - describe "test_new" do - before(:each) do - get :new - end - it "should render the new template" do get "new" expect(subject).to render_template :new From 634e1c44156d8fd8169dfeeea16ec2b592a89282 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 08:57:07 -0700 Subject: [PATCH 11/19] remove offending pry statements --- app/controllers/admin/categories_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index 310f376720..593294abcc 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -1,4 +1,3 @@ -require 'pry' class Admin::CategoriesController < Admin::BaseController cache_sweeper :blog_sweeper From b06de3fdb5f03ca4cab5051dc9ecc609321bacaa Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 09:30:57 -0700 Subject: [PATCH 12/19] add db to ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0f2c82fccf..70dfa33001 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ config/mail.yml *.log *~ +db/db_test +db/db_development db/*.sqlite* db/schema.rb .*.swp From 18082078b0be2aac85f1e196943004a44e0c7527 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 09:33:36 -0700 Subject: [PATCH 13/19] add cucumber test for failure to add category correctly --- features/manage_categories.feature | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/features/manage_categories.feature b/features/manage_categories.feature index 2228c881c4..5f0e8d7338 100644 --- a/features/manage_categories.feature +++ b/features/manage_categories.feature @@ -25,3 +25,10 @@ Feature: Manage Categories Then I should see "Category was successfully saved." And I should see "Another Test" And I should have 1 category + + Scenario: Unsuccessfully add a category + Given there are no categories + When I follow "Categories" + And I press "Save" + Then I should see "1 error prohibited this category from being saved" + And I should have 0 category From c71a75d9d8f2ac497f3af1bde01a10279db50574 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 09:34:10 -0700 Subject: [PATCH 14/19] fix bug not displaying failure to save category --- .../admin/categories_controller.rb | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/controllers/admin/categories_controller.rb b/app/controllers/admin/categories_controller.rb index 593294abcc..86bdad6126 100644 --- a/app/controllers/admin/categories_controller.rb +++ b/app/controllers/admin/categories_controller.rb @@ -24,22 +24,26 @@ def destroy private def new_or_edit - @categories = Category.find(:all) - @category = params[:id] ? Category.find(params[:id]) : Category.new - @category.attributes = params[:category] - if request.post? - respond_to do |format| - format.html { save_category } - format.js do - @category.save - @article = Article.new - @article.categories << @category - return render(:partial => 'admin/content/categories') + begin + @categories = Category.find(:all) + @category = params[:id] ? Category.find(params[:id]) : Category.new + @category.attributes = params[:category] + if request.post? + respond_to do |format| + format.html { save_category } + format.js do + @category.save + @article = Article.new + @article.categories << @category + return render(:partial => 'admin/content/categories') + end end + return end - return + render 'new' + rescue + render 'new' end - render 'new' end def save_category From e091fe44a8c71797f069fe086ef28917f0f8b956 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 09:36:53 -0700 Subject: [PATCH 15/19] add db files to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 70dfa33001..88b1690102 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ config/mail.yml *.log *~ +db/* db/db_test db/db_development db/*.sqlite* From 55e8b9f0b6ba686ba98d5b30901c64cae65e768b Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 09:43:48 -0700 Subject: [PATCH 16/19] remove db files from github --- db/converters/README | 14 -- db/converters/feed.rb | 68 ------ db/converters/mt3.rb | 172 ------------- db/converters/rss.rb | 67 ----- db/converters/s9y.rb | 182 -------------- db/converters/textpattern.rb | 137 ----------- db/db_development | Bin 143360 -> 0 bytes db/db_test | Bin 143360 -> 0 bytes db/migrate/001_initial_schema.rb | 145 ----------- db/migrate/002_add_user_email.rb | 17 -- db/migrate/003_add_article_user_id.rb | 31 --- db/migrate/004_add_sidebars.rb | 45 ---- db/migrate/005_add_cache_table.rb | 20 -- db/migrate/006_add_pages.rb | 17 -- db/migrate/007_add_permalink.rb | 36 --- db/migrate/008_add_page_title.rb | 20 -- db/migrate/009_add_article_guid.rb | 10 - db/migrate/010_add_tags.rb | 19 -- db/migrate/011_add_article_id.rb | 17 -- db/migrate/012_enlarge_settings.rb | 11 - db/migrate/013_add_textfilters.rb | 33 --- .../014_move_text_filter_to_text_filter_id.rb | 43 ---- db/migrate/015_convert_mysql_to_innodb.rb | 19 -- db/migrate/016_fix_is_primary_postgres.rb | 16 -- db/migrate/017_add_comment_user_id.rb | 23 -- db/migrate/018_add_guids.rb | 13 - db/migrate/019_add_whiteboards_to_content.rb | 15 -- db/migrate/020_superclass_articles.rb | 168 ------------- db/migrate/021_superclass_comments.rb | 94 -------- db/migrate/022_superclass_trackbacks.rb | 73 ------ db/migrate/023_superclass_pages.rb | 65 ----- db/migrate/024_cleanup_contents.rb | 44 ---- db/migrate/025_add_itunes_metadata.rb | 29 --- db/migrate/026_add_redirect_table.rb | 13 - db/migrate/027_set_comment_published_flag.rb | 19 -- db/migrate/028_rename_redirect_to.rb | 20 -- db/migrate/029_add_user_notification.rb | 29 --- db/migrate/030_index_sessions.rb | 9 - db/migrate/031_add_notifications_table.rb | 14 -- db/migrate/032_add_jabber_notification.rb | 11 - db/migrate/033_add_count_caching.rb | 34 --- db/migrate/034_boolify_published.rb | 36 --- db/migrate/035_boolify_content_allow_foo.rb | 36 --- db/migrate/036_add_tag_display_name.rb | 51 ---- db/migrate/037_enlarge_ip_field.rb | 9 - db/migrate/038_add_blog_object.rb | 52 ---- db/migrate/039_serialize_blog_attributes.rb | 167 ------------- db/migrate/040_attach_content_to_blog.rb | 28 --- db/migrate/041_fixup_default_sidebars.rb | 18 -- .../042_remove_sidebar_staged_config.rb | 22 -- db/migrate/043_create_triggers.rb | 14 -- db/migrate/044_add_published_at_to_content.rb | 18 -- .../045_fix_contents_published_default.rb | 9 - .../046_fixup_forthcoming_publications.rb | 40 --- db/migrate/047_add_content_state_field.rb | 24 -- db/migrate/048_remove_count_caching.rb | 31 --- .../049_move_feedback_to_new_state_machine.rb | 33 --- ...0_add_status_confirmed_field_to_content.rb | 19 -- db/migrate/051_fix_canonical_server_url.rb | 17 -- db/migrate/052_remove_cached_html.rb | 11 - .../053_promote_canonical_server_url.rb | 22 -- db/migrate/054_upgrade_sidebar_objects.rb | 26 -- db/migrate/055_link_sidebars_to_blog.rb | 17 -- db/migrate/056_create_notifications.rb | 33 --- db/migrate/057_add_categorization_model.rb | 69 ------ .../058_separate_entries_and_feedback.rb | 83 ------- db/migrate/059_cleanup_feedback_table.rb | 25 -- db/migrate/060_cleanup_contents_table.rb | 37 --- .../061_convert_title_prefix_setting.rb | 25 -- db/migrate/062_add_sitealizer_plugin.rb | 18 -- db/migrate/063_rejig_state_field.rb | 42 ---- db/migrate/064_add_users_profile.rb | 32 --- db/migrate/065_add_users_rights.rb | 119 --------- db/migrate/066_fix_profiles.rb | 23 -- db/migrate/067_remove_blog_ids.rb | 43 ---- db/migrate/068_fix_grants.rb | 13 - db/migrate/069_add_modules_to_profile.rb | 18 -- db/migrate/070_add_users_to_non_admins.rb | 17 -- db/migrate/071_fix_tags_naming.rb | 21 -- db/migrate/072_add_remember_token.rb | 9 - db/migrate/073_add_meta_and_subcategories.rb | 13 - .../074_add_remember_token_expires_at.rb | 9 - db/migrate/075_move_editor_to_user.rb | 13 - db/migrate/076_fix_users_empty_email.rb | 18 -- db/migrate/077_fix_userless_articles.rb | 27 --- db/migrate/078_add_textfilter_to_users.rb | 20 -- db/migrate/079_move_editor_as_string.rb | 19 -- db/migrate/080_add_state_to_user.rb | 17 -- db/migrate/081_create_cache_informations.rb | 66 ----- db/migrate/082_add_users_options.rb | 39 --- db/migrate/083_add_users_display_perms.rb | 19 -- db/migrate/084_move_users_to_profiles.rb | 19 -- db/migrate/085_add_article_parent_draft.rb | 9 - db/migrate/086_add_user_last_connection.rb | 9 - db/migrate/087_drop_blacklist_patterns.rb | 14 -- db/migrate/088_drop_session_table.rb | 16 -- .../089_drop_cache_information_table.rb | 31 --- db/migrate/090_remove_keywords_from_posts.rb | 9 - .../091_adds_password_protection_to_posts.rb | 9 - .../092_drops_profile_rights_primary_key.rb | 9 - db/migrate/093_add_redirections_model.rb | 58 ----- .../094_fix_extended_on_rss_behavior.rb | 14 -- db/migrate/095_adds_seo_to_profiles.rb | 17 -- db/migrate/096_add_origin_to_redirects.rb | 47 ---- .../097_fix_nofollow_options_behavior.rb | 18 -- db/migrate/098_add_users_settings.rb | 228 ------------------ ...099_splits_content_rules_articles_pages.rb | 19 -- db/migrate/100_adds_content_settings.rb | 132 ---------- db/migrate/101_adds_content_type.rb | 16 -- ...02_fixes_existing_articles_with_no_type.rb | 20 -- ...ng_articles_with_nil_or_empty_post_type.rb | 27 --- .../104_adds_created_at_to_redirects.rb | 14 -- db/schema.mysql-v3.sql | 3 - db/schema.mysql.sql | 3 - db/schema.postgresql.sql | 3 - db/schema.sqlite.sql | 3 - db/schema.sqlite3.sql | 3 - db/schema.sqlserver.sql | 3 - db/schema_version | 1 - db/scripts/fix_permalinks.rb | 5 - db/seeds.rb | 44 ---- db/updates/update.168.to.200.mysql.sql | 33 --- db/updates/update.168.to.200.psql.sql | 30 --- 123 files changed, 4265 deletions(-) delete mode 100644 db/converters/README delete mode 100644 db/converters/feed.rb delete mode 100755 db/converters/mt3.rb delete mode 100644 db/converters/rss.rb delete mode 100755 db/converters/s9y.rb delete mode 100755 db/converters/textpattern.rb delete mode 100644 db/db_development delete mode 100644 db/db_test delete mode 100644 db/migrate/001_initial_schema.rb delete mode 100644 db/migrate/002_add_user_email.rb delete mode 100644 db/migrate/003_add_article_user_id.rb delete mode 100644 db/migrate/004_add_sidebars.rb delete mode 100644 db/migrate/005_add_cache_table.rb delete mode 100644 db/migrate/006_add_pages.rb delete mode 100644 db/migrate/007_add_permalink.rb delete mode 100644 db/migrate/008_add_page_title.rb delete mode 100644 db/migrate/009_add_article_guid.rb delete mode 100644 db/migrate/010_add_tags.rb delete mode 100644 db/migrate/011_add_article_id.rb delete mode 100644 db/migrate/012_enlarge_settings.rb delete mode 100644 db/migrate/013_add_textfilters.rb delete mode 100644 db/migrate/014_move_text_filter_to_text_filter_id.rb delete mode 100644 db/migrate/015_convert_mysql_to_innodb.rb delete mode 100644 db/migrate/016_fix_is_primary_postgres.rb delete mode 100644 db/migrate/017_add_comment_user_id.rb delete mode 100644 db/migrate/018_add_guids.rb delete mode 100644 db/migrate/019_add_whiteboards_to_content.rb delete mode 100644 db/migrate/020_superclass_articles.rb delete mode 100644 db/migrate/021_superclass_comments.rb delete mode 100644 db/migrate/022_superclass_trackbacks.rb delete mode 100644 db/migrate/023_superclass_pages.rb delete mode 100644 db/migrate/024_cleanup_contents.rb delete mode 100644 db/migrate/025_add_itunes_metadata.rb delete mode 100644 db/migrate/026_add_redirect_table.rb delete mode 100644 db/migrate/027_set_comment_published_flag.rb delete mode 100644 db/migrate/028_rename_redirect_to.rb delete mode 100644 db/migrate/029_add_user_notification.rb delete mode 100644 db/migrate/030_index_sessions.rb delete mode 100644 db/migrate/031_add_notifications_table.rb delete mode 100644 db/migrate/032_add_jabber_notification.rb delete mode 100644 db/migrate/033_add_count_caching.rb delete mode 100644 db/migrate/034_boolify_published.rb delete mode 100644 db/migrate/035_boolify_content_allow_foo.rb delete mode 100644 db/migrate/036_add_tag_display_name.rb delete mode 100644 db/migrate/037_enlarge_ip_field.rb delete mode 100644 db/migrate/038_add_blog_object.rb delete mode 100644 db/migrate/039_serialize_blog_attributes.rb delete mode 100644 db/migrate/040_attach_content_to_blog.rb delete mode 100644 db/migrate/041_fixup_default_sidebars.rb delete mode 100644 db/migrate/042_remove_sidebar_staged_config.rb delete mode 100644 db/migrate/043_create_triggers.rb delete mode 100644 db/migrate/044_add_published_at_to_content.rb delete mode 100644 db/migrate/045_fix_contents_published_default.rb delete mode 100644 db/migrate/046_fixup_forthcoming_publications.rb delete mode 100644 db/migrate/047_add_content_state_field.rb delete mode 100644 db/migrate/048_remove_count_caching.rb delete mode 100644 db/migrate/049_move_feedback_to_new_state_machine.rb delete mode 100644 db/migrate/050_add_status_confirmed_field_to_content.rb delete mode 100644 db/migrate/051_fix_canonical_server_url.rb delete mode 100644 db/migrate/052_remove_cached_html.rb delete mode 100644 db/migrate/053_promote_canonical_server_url.rb delete mode 100644 db/migrate/054_upgrade_sidebar_objects.rb delete mode 100644 db/migrate/055_link_sidebars_to_blog.rb delete mode 100644 db/migrate/056_create_notifications.rb delete mode 100644 db/migrate/057_add_categorization_model.rb delete mode 100644 db/migrate/058_separate_entries_and_feedback.rb delete mode 100644 db/migrate/059_cleanup_feedback_table.rb delete mode 100644 db/migrate/060_cleanup_contents_table.rb delete mode 100644 db/migrate/061_convert_title_prefix_setting.rb delete mode 100644 db/migrate/062_add_sitealizer_plugin.rb delete mode 100644 db/migrate/063_rejig_state_field.rb delete mode 100644 db/migrate/064_add_users_profile.rb delete mode 100644 db/migrate/065_add_users_rights.rb delete mode 100644 db/migrate/066_fix_profiles.rb delete mode 100644 db/migrate/067_remove_blog_ids.rb delete mode 100644 db/migrate/068_fix_grants.rb delete mode 100644 db/migrate/069_add_modules_to_profile.rb delete mode 100644 db/migrate/070_add_users_to_non_admins.rb delete mode 100644 db/migrate/071_fix_tags_naming.rb delete mode 100644 db/migrate/072_add_remember_token.rb delete mode 100644 db/migrate/073_add_meta_and_subcategories.rb delete mode 100644 db/migrate/074_add_remember_token_expires_at.rb delete mode 100644 db/migrate/075_move_editor_to_user.rb delete mode 100644 db/migrate/076_fix_users_empty_email.rb delete mode 100644 db/migrate/077_fix_userless_articles.rb delete mode 100644 db/migrate/078_add_textfilter_to_users.rb delete mode 100644 db/migrate/079_move_editor_as_string.rb delete mode 100644 db/migrate/080_add_state_to_user.rb delete mode 100644 db/migrate/081_create_cache_informations.rb delete mode 100644 db/migrate/082_add_users_options.rb delete mode 100644 db/migrate/083_add_users_display_perms.rb delete mode 100644 db/migrate/084_move_users_to_profiles.rb delete mode 100644 db/migrate/085_add_article_parent_draft.rb delete mode 100644 db/migrate/086_add_user_last_connection.rb delete mode 100644 db/migrate/087_drop_blacklist_patterns.rb delete mode 100644 db/migrate/088_drop_session_table.rb delete mode 100644 db/migrate/089_drop_cache_information_table.rb delete mode 100644 db/migrate/090_remove_keywords_from_posts.rb delete mode 100644 db/migrate/091_adds_password_protection_to_posts.rb delete mode 100644 db/migrate/092_drops_profile_rights_primary_key.rb delete mode 100644 db/migrate/093_add_redirections_model.rb delete mode 100644 db/migrate/094_fix_extended_on_rss_behavior.rb delete mode 100644 db/migrate/095_adds_seo_to_profiles.rb delete mode 100644 db/migrate/096_add_origin_to_redirects.rb delete mode 100644 db/migrate/097_fix_nofollow_options_behavior.rb delete mode 100644 db/migrate/098_add_users_settings.rb delete mode 100644 db/migrate/099_splits_content_rules_articles_pages.rb delete mode 100644 db/migrate/100_adds_content_settings.rb delete mode 100644 db/migrate/101_adds_content_type.rb delete mode 100644 db/migrate/102_fixes_existing_articles_with_no_type.rb delete mode 100644 db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb delete mode 100644 db/migrate/104_adds_created_at_to_redirects.rb delete mode 100644 db/schema.mysql-v3.sql delete mode 100644 db/schema.mysql.sql delete mode 100644 db/schema.postgresql.sql delete mode 100644 db/schema.sqlite.sql delete mode 100644 db/schema.sqlite3.sql delete mode 100644 db/schema.sqlserver.sql delete mode 100644 db/schema_version delete mode 100755 db/scripts/fix_permalinks.rb delete mode 100644 db/seeds.rb delete mode 100644 db/updates/update.168.to.200.mysql.sql delete mode 100644 db/updates/update.168.to.200.psql.sql diff --git a/db/converters/README b/db/converters/README deleted file mode 100644 index 60417c7b19..0000000000 --- a/db/converters/README +++ /dev/null @@ -1,14 +0,0 @@ -These are converters for migrating from other blog systems to Typo. In -general, you're best off using the converter that best-matches your blog -system, and then falling back to the RSS or Feed converter if the others fail. -These converters aren't always well tested, so please back up your data before -converting, and please file bugs at http://www.typosphere.org/trac. - -Available converters: - -* mt3.rb: Converts from Movable Type 3.x -* s9y.rb: Converts from Serendipity (aka s9y) -* textpattern.rb: Converts from TextPattern -* feed.rb: Converts from any RSS or Atom feed. Requires the 'feed_tools' gem. - -For Wordpress and Dotclear 1.2 and Dotclear 2 conversion, please use the converters in vendors/plugins \ No newline at end of file diff --git a/db/converters/feed.rb b/db/converters/feed.rb deleted file mode 100644 index 683acacba3..0000000000 --- a/db/converters/feed.rb +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env ruby - -# RSS 0.2/2.0/Atom converter to typo by Lennon Day-Reynolds -# Shamelessly copied from RSS-only converter by Chris Lee - -require File.dirname(__FILE__) + '/../../config/environment' -require 'optparse' -begin - require 'feed_tools' -rescue LoadError - STDERR.puts <<-EOF -This converter requires feedtools to be installed. -Please run `gem install feedtools` and try again. -EOF - exit 1 -end - -class FeedMigrate - attr_accessor :options - - def initialize - self.options = {} - self.parse_options - self.convert_entries - end - - def convert_entries - feed = FeedTools::Feed.open(self.options[:url]) - puts "Converting #{feed.items.length} entries..." - feed.items.each do |item| - puts "Converting '#{item.title}'" - a = Article.new - a.author = self.options[:author] - a.title = item.title - a.body = item.description - a.created_at = item.published - a.save - end - end - - def parse_options - OptionParser.new do |opt| - opt.banner = 'Usage: feed.rb [options]' - - opt.on('-a', '--author AUTHOR', 'Username of author in typo') do |a| - self.options[:author] = a - end - - opt.on('-u', '--url URL', 'URL of RSS feed to import.') do |u| - self.options[:url] = u - end - - opt.on_tail('-h', '--help', 'Show this message.') do - puts opt - exit - end - - opt.parse!(ARGV) - end - - unless self.options.include?(:author) and self.options.include?(:url) - puts 'See feed.rb --help for help.' - exit - end - end -end - -FeedMigrate.new diff --git a/db/converters/mt3.rb b/db/converters/mt3.rb deleted file mode 100755 index 718e486180..0000000000 --- a/db/converters/mt3.rb +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env ruby - -# MovableType 3.x converter for typo by Patrick Lenz -# -# MAKE BACKUPS OF EVERYTHING BEFORE RUNNING THIS SCRIPT! -# THIS SCRIPT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND - -require File.dirname(__FILE__) + '/../../config/environment' -require 'optparse' - -class MTMigrate - attr_accessor :options - - def initialize - self.options = {} - self.parse_options - self.convert_categories - self.convert_entries - self.convert_prefs - end - - def convert_categories - mt_categories = ActiveRecord::Base.connection.select_all(%{ - SELECT category_label AS name - FROM `#{self.options[:mt_db]}`.mt_category - WHERE category_blog_id = '#{self.options[:blog_id]}' - }) - - puts "Converting #{mt_categories.size} categories.." - - mt_categories.each do |cat| - Category.create(cat) unless Category.find_by_name(cat['name']) - end - end - - def convert_entries - default_filter = translate_filter ActiveRecord::Base.connection.select_all(%{ - SELECT - blog_convert_paras - FROM `#{self.options[:mt_db]}`.mt_blog - WHERE blog_id = '#{self.options[:blog_id]}' - })[0]["blog_convert_paras"] - - mt_entries = ActiveRecord::Base.connection.select_all(%{ - SELECT - entry_id, - entry_allow_comments AS allow_comments, - entry_allow_pings AS allow_pings, - entry_title AS title, - entry_text AS body, - entry_text_more AS extended, - entry_excerpt AS excerpt, - entry_convert_breaks AS convert_breaks, - entry_keywords AS keywords, - entry_created_on AS created_at, - entry_modified_on AS updated_at, - author_name AS author - FROM `#{self.options[:mt_db]}`.mt_entry, `#{self.options[:mt_db]}`.mt_author - WHERE entry_blog_id = '#{self.options[:blog_id]}' - AND author_id = entry_author_id - }) - - puts "Converting #{mt_entries.size} entries.." - - mt_entries.each do |entry| - a = Article.new - a.attributes = entry.reject { |k,v| k =~ /entry_id|convert_breaks/ } - - if entry["convert_breaks"] == "__default__" - a.text_filter = default_filter - else - a.text_filter = translate_filter entry["convert_breaks"] - end - - a.save - - # Fetch category assignments - ActiveRecord::Base.connection.select_all(%{ - SELECT category_label, placement_is_primary - FROM `#{self.options[:mt_db]}`.mt_category, `#{self.options[:mt_db]}`.mt_entry, `#{self.options[:mt_db]}`.mt_placement - WHERE entry_id = #{entry['entry_id']} - AND category_id = placement_category_id - AND entry_id = placement_entry_id - }).each do |c| - a.categories.push_with_attributes(Category.find_by_name(c['category_label']), :is_primary => c['placement_is_primary']) - end - - # Fetch comments - ActiveRecord::Base.connection.select_all(%{ - SELECT - comment_author AS author, - comment_email AS email, - comment_url AS url, - comment_text AS body, - comment_created_on AS created_at, - comment_modified_on AS updated_at - FROM `#{self.options[:mt_db]}`.mt_comment - WHERE comment_entry_id = #{entry['entry_id']} - }).each do |c| - a.comments.create(c) - end - - # Fetch trackbacks - ActiveRecord::Base.connection.select_all(%{ - SELECT - tbping_title AS title, - tbping_excerpt AS excerpt, - tbping_source_url AS url, - tbping_ip AS ip, - tbping_blog_name AS blog_name, - tbping_created_on AS created_at, - tbping_modified_on AS updated_at - FROM `#{self.options[:mt_db]}`.mt_tbping, `#{self.options[:mt_db]}`.mt_trackback - WHERE tbping_tb_id = trackback_id - AND trackback_entry_id = #{entry['entry_id']} - }).each do |tb| - a.trackbacks.create(tb) - end - end - end - - def convert_prefs - puts "Converting prefs" - - ActiveRecord::Base.connection.select_one(%{ - SELECT - blog_name, - blog_allow_comments_default AS default_allow_comments, - blog_allow_pings_default AS default_allow_pings - FROM `#{self.options[:mt_db]}`.mt_blog - WHERE blog_id = '#{self.options[:blog_id]}' - }).each do |pref_name, pref_value| - begin - Setting.find_by_name(pref_name).update_attribute("value", pref_value) - rescue - Setting.create({'name' => pref_name, 'value' => pref_value}) - end - end - - end - - def parse_options - OptionParser.new do |opt| - opt.banner = "Usage: mt3.rb [options]" - - opt.on('--blog-id BLOGID', Integer, 'Blog ID to import from.') { |i| self.options[:blog_id] = i } - opt.on('--db DBNAME', String, 'Movable Type database name.') { |d| self.options[:mt_db] = d } - - opt.on_tail('-h', '--help', 'Show this message.') do - puts opt - exit - end - - opt.parse!(ARGV) - end - - unless self.options.include?(:blog_id) and self.options.include?(:mt_db) - puts "See mt3.rb --help for help." - exit - end - end - - def translate_filter(input) - return case input - when /textile/ then 'textile' - when /markdown/ then 'markdown' - else nil - end - end -end - -MTMigrate.new diff --git a/db/converters/rss.rb b/db/converters/rss.rb deleted file mode 100644 index 33cdcecf60..0000000000 --- a/db/converters/rss.rb +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby - -# RSS 0.9/2.0 converter for typo by Chris Lee -# -# No need to make a backup of the original blog, really. This takes a URL for a -# read-only import, so there's not really any chance of it munging the original -# blog's data, unless somehow an HTTP GET causes your blog server to ignite. -# -# Even so, this script is still PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. - -require File.dirname(__FILE__) + '/../../config/environment' -require 'optparse' -require 'net/http' -require 'rss/2.0' - -class RSSMigrate - attr_accessor :options - - def initialize - self.options = {} - self.parse_options - self.convert_entries - end - - def convert_entries - feed = Net::HTTP.get(URI.parse(self.options[:url])) - rss = RSS::Parser.parse(feed) - puts "Converting #{rss.items.length} entries..." - rss.items.each do |item| - puts "Converting '#{item.title}'" - a = Article.new - a.author = self.options[:author] - a.title = item.title - a.body = item.description - a.created_at = item.pubDate - a.save - end - end - - def parse_options - OptionParser.new do |opt| - opt.banner = 'Usage: rss.rb [options]' - - opt.on('-a', '--author AUTHOR', 'Username of author in typo') do |a| - self.options[:author] = a - end - - opt.on('-u', '--url URL', 'URL of RSS feed to import.') do |u| - self.options[:url] = u - end - - opt.on_tail('-h', '--help', 'Show this message.') do - puts opt - exit - end - - opt.parse!(ARGV) - end - - unless self.options.include?(:author) and self.options.include?(:url) - puts 'See rss.rb --help for help.' - exit - end - end -end - -RSSMigrate.new diff --git a/db/converters/s9y.rb b/db/converters/s9y.rb deleted file mode 100755 index 7ab2e28162..0000000000 --- a/db/converters/s9y.rb +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env ruby - -# Serendipity (S9Y) 0.8.x converter for typo by Jochen Schalanda -# heavily based on the Wordpress 1.5x converter by Patrick Lenz -# -# MAKE BACKUPS OF EVERYTHING BEFORE RUNNING THIS SCRIPT! -# THIS SCRIPT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND -# -# -# SECURITY NOTICE: -# -# Migrated users will have the default password "password", since the -# MD5 hashes of S9Y cannot be converted to salted SHA1 hashes which are -# used by Typo. -# - -require File.dirname(__FILE__) + '/../../config/environment' -require 'optparse' - -class S9YMigrate - attr_accessor :options - - def initialize - self.options = {} - self.parse_options - self.convert_users - self.convert_categories - self.convert_entries - self.convert_prefs - end - - def convert_categories - s9y_categories = ActiveRecord::Base.connection.select_all(%{ - SELECT category_name AS name - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}category` - }) - - puts "Converting #{s9y_categories.size} categories.." - - s9y_categories.each do |cat| - Category.create(cat) unless Category.find_by_name(cat['name']) - end - end - - def convert_entries - s9y_entries = ActiveRecord::Base.connection.select_all(%{ - SELECT - id, - (CASE allow_comments WHEN 'true' THEN '1' ELSE '0' END) AS allow_comments, - title, - body, - extended, - FROM_UNIXTIME(timestamp) AS created_at, - FROM_UNIXTIME(last_modified) AS updated_at, - author, - authorid AS user_id, - (CASE isdraft WHEN 'true' THEN '0' ELSE '1' END) AS published - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}entries` - }) - - puts "Converting #{s9y_entries.size} entries.." - - s9y_entries.each do |entry| - a = Article.new - a.attributes = entry.reject { |k,v| k =~ /^(id)/ } - a.save - - # Fetch category assignments - ActiveRecord::Base.connection.select_all(%{ - SELECT category_name - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}category`, `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}entrycat` - WHERE entryid = #{entry['id']} - AND `#{self.options[:s9y_prefix]}entrycat`.categoryid = `#{self.options[:s9y_prefix]}category`.categoryid - }).each do |c| - a.categories.push_with_attributes(Category.find_by_name(c['category_name']), :is_primary => 0) - end - - # Fetch comments - ActiveRecord::Base.connection.select_all(%{ - SELECT - author, - email, - url, - body, - FROM_UNIXTIME(timestamp) AS created_at, - ip - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}comments` - WHERE id = #{entry['id']} - AND type != 'TRACKBACK' - AND status = 'approved' - }).each do |c| - a.comments.create(c) - end - - # Fetch trackbacks - ActiveRecord::Base.connection.select_all(%{ - SELECT - author AS blog_name, - url, - title, - body AS excerpt, - FROM_UNIXTIME(timestamp) AS created_at, - ip - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}comments` - WHERE entry_id = #{entry['id']} - AND type = 'TRACKBACK' - AND status = 'approved' - }).each do |c| - a.trackbacks.create(c) - end - - end - end - - def convert_prefs - puts "Converting prefs" - - ActiveRecord::Base.connection.select_all(%{ - SELECT - (CASE name - WHEN 'blogTitle' THEN 'blog_name' - WHEN 'blogDescription' THEN 'blog_subtitle' - END) AS name, - value - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}config` - WHERE name IN ('blogTitle', 'blogDescription') - }).each do |pref| - begin - Setting.find_by_name(pref['name']).update_attribute("value", pref['value']) - rescue - Setting.create(pref) - end - end - end - -def convert_users - puts "Converting users" - puts "** all users will have the default password \"password\" **" - puts "** you should change it as soon as possible! **" - - ActiveRecord::Base.connection.select_all(%{ - SELECT - realname AS name, - username AS login, - email - FROM `#{self.options[:s9y_db]}`.`#{self.options[:s9y_prefix]}authors` - }).each do |user| - u = User.new - u.attributes = user - u.password = "password" - u.save - end - end - - def parse_options - OptionParser.new do |opt| - opt.banner = "Usage: s9y.rb [options]" - - opt.on('--db DBNAME', String, 'S9Y database name.') { |d| self.options[:s9y_db] = d } - opt.on('--prefix PREFIX', String, 'S9Y table prefix (defaults to empty string).') { |d| self.options[:s9y_prefix] = d } - - opt.on_tail('-h', '--help', 'Show this message.') do - puts opt - exit - end - - opt.parse!(ARGV) - end - - unless self.options.include?(:s9y_db) - puts "See s9y.rb --help for help." - exit - end - - unless self.options.include?(:s9y_prefix) - self.options[:s9y_prefix] = "" - end - - end -end - -S9YMigrate.new diff --git a/db/converters/textpattern.rb b/db/converters/textpattern.rb deleted file mode 100755 index 9f1e9ce0da..0000000000 --- a/db/converters/textpattern.rb +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env ruby - -# TextPattern 1.x converter for typo by Patrick Lenz -# -# MAKE BACKUPS OF EVERYTHING BEFORE RUNNING THIS SCRIPT! -# THIS SCRIPT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND - -require File.dirname(__FILE__) + '/../../config/environment' -require 'optparse' - -class TXPMigrate - attr_accessor :options - - def initialize - self.options = {} - self.parse_options - self.convert_categories - self.convert_entries - self.convert_prefs - end - - def convert_categories - txp_categories = ActiveRecord::Base.connection.select_all(%{ - SELECT name - FROM `#{self.options[:txp_db]}`.`#{self.options[:txp_pfx]}`txp_category - WHERE parent = 'root' - AND type = 'article' - }) - - puts "Converting #{txp_categories.size} categories.." - - txp_categories.each do |cat| - Category.create(cat) unless Category.find_by_name(cat['name']) - end - end - - def convert_entries - txp_entries = ActiveRecord::Base.connection.select_all(%{ - SELECT - ID, - Annotate AS allow_comments, - 1 AS allow_pings, - Title AS title, - (CASE LENGTH(Body) WHEN 0 THEN Excerpt ELSE Body END) AS body, - Body_html AS body_html, - Excerpt AS excerpt, - Keywords AS keywords, - Posted AS created_at, - LastMod AS updated_at, - AuthorID AS author, - (CASE textile_body WHEN '1' THEN 'textile' ELSE 'none' END) AS text_filter, - (CASE Status WHEN '1' THEN '0' ELSE '1' END) AS published, - Category1, Category2 - FROM `#{self.options[:txp_db]}`..`#{self.options[:txp_pfx]}`textpattern - }) - - puts "Converting #{txp_entries.size} entries.." - - txp_entries.each do |entry| - a = Article.new - a.attributes = entry.reject { |k,v| k =~ /^(Category|ID)/ } - a.save - - # Assign categories - puts "Assign primary category for entry #{entry['ID']}" - a.categories.push_with_attributes(Category.find_by_name(entry['Category1']), :is_primary => 1) rescue nil - puts "Assign secondary category for entry #{entry['ID']}" - a.categories.push_with_attributes(Category.find_by_name(entry['Category2']), :is_primary => 0) rescue nil - - # Fetch comments - ActiveRecord::Base.connection.select_all(%{ - SELECT - name AS author, - email AS email, - web AS url, - message AS body, - message as body_html, - posted AS created_at, - ip AS ip - FROM `#{self.options[:txp_db]}`..`#{self.options[:txp_pfx]}`txp_discuss - WHERE parentid = #{entry['ID']} - }).each do |c| - a.comments.create(c) - end - - end - end - - def convert_prefs - puts "Converting prefs" - - ActiveRecord::Base.connection.select_all(%{ - SELECT - (CASE name - WHEN 'sitename' THEN 'blog_name' - WHEN 'comments_on_default' THEN 'default_allow_comments' - WHEN 'use_textile' THEN 'text_filter' - END) AS name, - val AS value - FROM `#{self.options[:txp_db]}`..`#{self.options[:txp_pfx]}`txp_prefs - WHERE name IN ('sitename', 'comments_on_default', 'use_textile') - }).each do |pref| - if pref['name'] == "text_filter" and pref['value'].to_i > 0 - pref['value'] = 'textile' - end - - begin - Setting.find_by_name(pref['name']).update_attribute("value", pref['value']) - rescue - Setting.create(pref) - end - end - end - - def parse_options - OptionParser.new do |opt| - opt.banner = "Usage: textpattern.rb [options]" - - opt.on('--db DBNAME', String, 'Text Pattern database name.') { |d| self.options[:txp_db] = d } - opt.on('--pf PREFIX', String, 'Textpattern table prefix.') { |p| self.options[:txp_pfx] = p } - - opt.on_tail('-h', '--help', 'Show this message.') do - puts opt - exit - end - - opt.parse!(ARGV) - end - - unless self.options.include?(:txp_db) - puts "See textpattern.rb --help for help." - exit - end - end -end - -TXPMigrate.new diff --git a/db/db_development b/db/db_development deleted file mode 100644 index 9cfaa678ddce52a4358302dee9c4d2b8b81789c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 143360 zcmeI54Qw3Qeb{GqXSw7`GfzAnZ;$3t98xD!Yu%Fj{Xw7Zj*=*fI*Q^^q$tTguV;6M zyK|b|*_)Z=hhiI8-X*acr!kViXkE8(gCKE`G&Y>nXxcP2nvb@2lcq(TAV~`(EgBcj zN0HPn(zs~*e{Xj7o4z~h5J<*7miBssWE?JYRn%zcaA^gZ6&X(rdrfYwP0&T z)#^Nc>hi|Y;^vaPxp--HNuKHSnvu`XXvGh5d1*sl-&nb^xN%p0dFigaxV3q6 zWewuqSX$eZ*KWf9*6QkW@=U>~+G^F#(TExxmQ)j5-DEqRL-v#Y;Drl(V~QDAGmRZh zSFN0>mCCl&^L4D-%pPBAY164Q2bwWWtkW&jICt6~oSftjC%dwBQ+#r8M#o~ID|uC) zk#`ldP*%+Iv1Bp?CRMe9T2(4)pGUmj4XKhin3Z_=04XWEOR2lULUkvh%QLS23_nFAmv}(!9 z8P%L(+F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Afv)XkP+c| z&uB6$ydPvnSOA$8vLI7J24qr5gG>l1kZ~aiGA1NIMuj-Yh!FFPCbB{lWJZX9ObhcM zQ^Fj`q!0#~5S{}W7cPK|3GV|L6+$2*!g|%6_Ajh4uc|rQeeNmGl+qmteL3v*Zt?pOpT-^l9lwV71?n9!Qp?ODg#~toFC1 zb!kPqB)uQj`eEt4(iHi3($mr?to6O({}I0}{<-)KSn2;B`8VQ!5Wgn=n)uIQrT+!- z^Wr}gKO_Da`Bm|g;`fUm6ZgcLsEK*;1LCH5<1y&wXd)6o0!RP}AOR$R1dsp{Kmw04 z0l)V&4-50MqhlpUM|T_@QHQ*vd^THTDpO!8oo6bgFqQl;Q;8f?@eeT-dzGo^2bqd| zfT~RP9#fgSOr`HImD*-1d7G)k7E|#}ree34if%9!d4;NUcAcrrO{UUoOr>rxm0V>i z@iJ5K>rBN~n2KIwDzZ#fDtncw%o0=SD@>&>GnKr=RAP~-_)AR1USulz0#lKTR3)>| zGnIKiQ|Se!Qdy>w8Kx3xrs654Vo9c=38o@(suI~4Q<*4J=?GJ)d8U$cOeMlh#h+s; zc7dtr`O1m&&MT$a{JO*8l$>wSC9< diff --git a/db/db_test b/db/db_test deleted file mode 100644 index 8da5251a77d9197104e976e570e9a31743792d38..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 143360 zcmeI5du$xXeaG)HG8s#8ob&Q-Np5v7 z@9s&W+ZZ_7Y2&78jWh_*GzHS2j}$GMB594bNQHZ|`>Rj-ti*k5Kp$=I^&VGdqvZ{C+dP*`=Xpo}M!uBeC4DYPyrihW3QQ;m|{g zL?{$`AN?MqU+-s{6b>>9Q`iN&E1_ymK$})s5>R`ph=f2hDE7fwf@B4=qpC4te02G z;E9T0-|Qvr8A_#>?>*9?(#sITlk=#xnHq~9qgKzkRC;B6?eIQAy+T{!G-yFudrpbP zPn-y^KP$UYZ#d?%S=Qw;6u41?T?yoEsWZbDqLyt~{^dZdSVQKFl3PtNfqhfi9@!m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*0uEEbxWm^ge`{Igw^#?|`Sj`r@Srlu0l zJwGPYkG^~C&S)%jSp0~89Ebi@paoZT?t*2fA~#lb_{~?1@Bi1CQe=Su2!H?xfB*=9 z00@8p2!H?xfWS>c0O$XkWFj#P5C8!X009sH0T2KI5C8!X009uV4gqogUsXOB;{V0J z%m0mki~ke<8viQ)3jb^Vm;6upXZY{)-{!x`Kh8hKKf*u6U*|u`U*#|JYuw^hzRX|X z@8Ao3opa`Wx!6s2^27tbS1aY4yG8y82`46}74Uh+0wKrCwAosB`LL>O<Y_S zZR$aFk2YQnPTT7!UXle? zBstAyNak6AWR6Xf%(6Vm49k&Bvn>iTS>=em7nzb)9e7r6x$yePZ!xfk~3^C$pRZE zInDNv%rj0h$5fJ8rjX3A-6Yd&7s*s~EW(S?oe@40-4Wr1Xe`2~qoWa?kB&rmF3KW2 z8;wSICK`$G^hj9PQ*Mm>VO5z5@&DkTR%Vs^mAo=V?*e{@&iud1KgxfOe}KP_PWLmXw z^%ixU&iYa1f0X}JzO8(dPWpe#|3dj2<@3sCl|P`9{wI`=E5E3GSovB0$I4GB?@?Y> zt}0E%RF;(Ilm+GNHgI!v5d=U01V8`;KmY_l00cnbhnYYux-U!z^Ho=8R$QH4c6G`a zjgE(l#fnrjWvL2FQcdepv6ERJM3h zs+ki~74DE~`nXj2+oj4KlPa5(Dsxn-bV91sq)?gS5vgV-q$=Dd)%0Ph^0!KrJ0w;1 z7O66EsnQ3fN*xd?UED9#%s#0Kd!?Elmny$UsvMUpt4ftoq)P9WDz$4Q%EQGmA!l|9 gS=b@ubWF(nsF1l4A+t=#OjO8pWHh>OC!PQQA90nRbN~PV diff --git a/db/migrate/001_initial_schema.rb b/db/migrate/001_initial_schema.rb deleted file mode 100644 index b05ef815c0..0000000000 --- a/db/migrate/001_initial_schema.rb +++ /dev/null @@ -1,145 +0,0 @@ -class Bare1Category < ActiveRecord::Base - include BareMigration -end - -class Bare1Article < ActiveRecord::Base - include BareMigration -end - -class Bare1ArticlesCategory < ActiveRecord::Base - include BareMigration -end - -class InitialSchema < ActiveRecord::Migration - def self.up - ActiveRecord::Base.transaction do - create_table :users do |t| - t.column :login, :string - t.column :password, :string - end - - create_table :articles do |t| - t.column :title, :string - t.column :author, :string - t.column :body, :text - t.column :body_html, :text - t.column :extended, :text - t.column :excerpt, :text - t.column :keywords, :string - t.column :allow_comments, :integer - t.column :allow_pings, :integer - t.column :published, :integer, :default => 1 - t.column :text_filter, :string - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :extended_html, :text - t.column :permalink, :string - end - - add_index :articles, :permalink - - create_table :categories do |t| - t.column :name, :string - t.column :position, :integer - end - - category = Bare1Category.create(:name => 'General', - :position => 1 - ) - - article = Bare1Article.create(:title=>'Hello World!', - :author=>'Mr Typo', - :body=>'Welcome to Typo. This is your first article. Edit or delete it, then start blogging!', - :allow_comments => 1, - :allow_pings =>1, - :published => 1, - :permalink => 'hello-world' - ) - - create_table :blacklist_patterns do |t| - t.column :type, :string - t.column :pattern, :string - end - - add_index :blacklist_patterns, :pattern - - create_table :comments do |t| - t.column :article_id, :integer - t.column :title, :string - t.column :author, :string - t.column :email, :string - t.column :url, :string - t.column :ip, :string - t.column :body, :text - t.column :body_html, :text - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - add_index :comments, :article_id - - create_table :pings do |t| - t.column :article_id, :integer - t.column :url, :string - t.column :created_at, :datetime - end - - add_index :pings, :article_id - - create_table :resources do |t| - t.column :size, :integer - t.column :filename, :string - t.column :mime, :string - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - create_table :sessions do |t| - t.column :sessid, :string - t.column :data, :text - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - create_table :settings do |t| - t.column :name, :string - t.column :value, :string - t.column :position, :integer - end - - create_table :trackbacks do |t| - t.column :article_id, :integer - t.column :blog_name, :string - t.column :title, :string - t.column :excerpt, :string - t.column :url, :string - t.column :ip, :string - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - add_index :trackbacks, :article_id - end - end - - def self.down - ActiveRecord::Base.transaction do - remove_index :articles, :permalink - remove_index :blacklist_patterns, :pattern - remove_index :comments, :article_id - remove_index :pings, :article_id - remove_index :trackbacks, :article_id - - drop_table :users - drop_table :articles - drop_table :categories - drop_table :blacklist_patterns - drop_table :comments - drop_table :pings - drop_table :resources - drop_table :sessions - drop_table :settings - drop_table :trackbacks - end - end -end diff --git a/db/migrate/002_add_user_email.rb b/db/migrate/002_add_user_email.rb deleted file mode 100644 index c8bdff899a..0000000000 --- a/db/migrate/002_add_user_email.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddUserEmail < ActiveRecord::Migration - class BareUser < ActiveRecord::Base - include BareMigration - end - - def self.up - modify_tables_and_update([:add_column, BareUser, :email, :text], - [:add_column, BareUser, :name, :text]) do |u| - u.name = u.login - end - end - - def self.down - remove_column :users, :email - remove_column :users, :name - end -end diff --git a/db/migrate/003_add_article_user_id.rb b/db/migrate/003_add_article_user_id.rb deleted file mode 100644 index fd348d2001..0000000000 --- a/db/migrate/003_add_article_user_id.rb +++ /dev/null @@ -1,31 +0,0 @@ -class AddArticleUserId < ActiveRecord::Migration - class BareArticle < ActiveRecord::Base - include BareMigration - end - - class BareUser < ActiveRecord::Base - include BareMigration - end - - def self.up - say "Linking article authors to users" - modify_tables_and_update(:add_column, BareArticle, :user_id, :integer) do |art| - art.user_id = (BareUser.find_by_name(art.author).id rescue nil) - end - user_first = BareUser.first - if user_first.nil? - user_id = 1 - else - user_id = user_first.id - end - - BareArticle.find(:all, :conditions => 'user_id IS NULL').each do |art| - art.user_id = user_id - art.save! - end - end - - def self.down - remove_column :articles, :user_id - end -end diff --git a/db/migrate/004_add_sidebars.rb b/db/migrate/004_add_sidebars.rb deleted file mode 100644 index 62c1cc6d05..0000000000 --- a/db/migrate/004_add_sidebars.rb +++ /dev/null @@ -1,45 +0,0 @@ -class Bare4Sidebar < ActiveRecord::Base - include BareMigration - - # there's technically no need for these serialize declaration because in - # this script active_config and staged_config will always be NULL anyway. - serialize :active_config - serialize :staged_config -end - -class AddSidebars < ActiveRecord::Migration - def self.up - say "Creating sidebars" - Bare4Sidebar.transaction do - create_table :sidebars do |t| - t.column :controller, :string - t.column :active_position, :integer - t.column :active_config, :text - t.column :staged_position, :integer - t.column :staged_config, :text - end - - Bare4Sidebar.create(:active_position=>0, :controller=>'page', :active_config=>'--- !map:HashWithIndifferentAccess - maximum_pages: "10"') - Bare4Sidebar.create(:active_position=>1, :controller=>'category', :active_config=>'--- !map:HashWithIndifferentAccess - empty: false - count: true') - Bare4Sidebar.create(:active_position=>2, :controller=>'archives', :active_config=>'--- !map:HashWithIndifferentAccess - show_count: true - count: "10"') - Bare4Sidebar.create(:active_position=>3, :controller=>'static', :active_config=>'--- !map:HashWithIndifferentAccess - body: "\n" - title: Links' - ) - Bare4Sidebar.create(:active_position=>4, :controller=>'meta', :active_config=>'--- !map:HashWithIndifferentAccess - title: Meta') - end - end - - def self.down - drop_table :sidebars - end -end - - diff --git a/db/migrate/005_add_cache_table.rb b/db/migrate/005_add_cache_table.rb deleted file mode 100644 index ade663e3d5..0000000000 --- a/db/migrate/005_add_cache_table.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'fileutils' - -class AddCacheTable < ActiveRecord::Migration - def self.up - FileUtils.rm_rf("public/articles") - FileUtils.rm_rf("public/xml") - FileUtils.rm_rf("public/index.html") - create_table :page_caches do |t| - t.column :name, :string - end - add_index :page_caches, :name - end - - def self.down - # TODO: how can this script sweep the page cache? - # Like PageCache.sweep('/') but without calling a model? - remove_index :page_caches, :name - drop_table :page_caches - end -end diff --git a/db/migrate/006_add_pages.rb b/db/migrate/006_add_pages.rb deleted file mode 100644 index 8b21988797..0000000000 --- a/db/migrate/006_add_pages.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddPages < ActiveRecord::Migration - def self.up - create_table :pages do |t| - t.column :name, :string - t.column :user_id, :integer - t.column :body, :text - t.column :body_html, :text - t.column :text_filter, :string - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - end - - def self.down - drop_table :pages - end -end diff --git a/db/migrate/007_add_permalink.rb b/db/migrate/007_add_permalink.rb deleted file mode 100644 index 7ea756b967..0000000000 --- a/db/migrate/007_add_permalink.rb +++ /dev/null @@ -1,36 +0,0 @@ -class AddPermalink < ActiveRecord::Migration - class BareArticle < ActiveRecord::Base - include BareMigration - - def stripped_title(title) - # this is a copynpaste of the routine in article.rb - # so the one in article.rb can change w/o breaking this. - self.title.gsub(/<[^>]*>/,'').to_url - end - end - - class BareCategory < ActiveRecord::Base - include BareMigration - - def stripped_name - # copynpaste from category.rb - self.name.to_url - end - end - - def self.up - say "Adding categories permalink" - modify_tables_and_update([:add_column, BareCategory, :permalink, :string], - [:add_index, BareCategory, :permalink]) do - BareCategory.find_and_update {|c| c.permalink ||= c.stripped_name } - BareArticle.find_and_update {|a| a.permalink ||= a.stripped_title } - end - end - - - def self.down - say "Removing categories permalink" - remove_index :categories, :permalink - remove_column :categories, :permalink - end -end diff --git a/db/migrate/008_add_page_title.rb b/db/migrate/008_add_page_title.rb deleted file mode 100644 index 9d7f642ca9..0000000000 --- a/db/migrate/008_add_page_title.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Bare8Page < ActiveRecord::Base - include BareMigration -end - -class AddPageTitle < ActiveRecord::Migration - def self.up - add_column :pages, :title, :string - - Bare8Page.create(:name=>"about", - :title=>"about", - :user_id=>1, - :body=>"This is an example of a Typo page. You can edit this to write information about yourself or your site so readers know who you are. You can create as many pages as this one as you like and manage all of your content inside Typo." - ) - - end - - def self.down - remove_column :pages, :title - end -end diff --git a/db/migrate/009_add_article_guid.rb b/db/migrate/009_add_article_guid.rb deleted file mode 100644 index 46ccf35915..0000000000 --- a/db/migrate/009_add_article_guid.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddArticleGuid < ActiveRecord::Migration - def self.up - # the guid itself will be added later in the migration - add_column :articles, :guid, :string - end - - def self.down - remove_column :articles, :guid - end -end diff --git a/db/migrate/010_add_tags.rb b/db/migrate/010_add_tags.rb deleted file mode 100644 index 0bdace77a3..0000000000 --- a/db/migrate/010_add_tags.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AddTags < ActiveRecord::Migration - def self.up - create_table :tags do |t| - t.column :name, :string - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - create_table :articles_tags, :id => false do |t| - t.column :article_id, :integer - t.column :tag_id, :integer - end - end - - def self.down - drop_table :tags - drop_table :articles_tags - end -end diff --git a/db/migrate/011_add_article_id.rb b/db/migrate/011_add_article_id.rb deleted file mode 100644 index e5ba373f87..0000000000 --- a/db/migrate/011_add_article_id.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Bare11Resource < ActiveRecord::Base - include BareMigration -end - -class AddArticleId < ActiveRecord::Migration - def self.up - Dir.mkdir("#{::Rails.root.to_s}/public/files") unless File.directory?("#{::Rails.root.to_s}/public/files") - add_column :resources, :article_id, :integer - Bare11Resource.reset_column_information - # TODO: resources probably don't get migrated properly. - # Resource.find(:all) { |r| r.update } - end - - def self.down - remove_column :resources, :article_id - end -end diff --git a/db/migrate/012_enlarge_settings.rb b/db/migrate/012_enlarge_settings.rb deleted file mode 100644 index 4a6656a2c5..0000000000 --- a/db/migrate/012_enlarge_settings.rb +++ /dev/null @@ -1,11 +0,0 @@ -class EnlargeSettings < ActiveRecord::Migration - def self.up - change_column :settings, :name, :string, :limit => 255 - change_column :settings, :value, :string, :limit => 255 - end - - def self.down - change_column :settings, :name, :string, :limit => 40 - change_column :settings, :value, :string, :limit => 40 - end -end diff --git a/db/migrate/013_add_textfilters.rb b/db/migrate/013_add_textfilters.rb deleted file mode 100644 index 5917802fac..0000000000 --- a/db/migrate/013_add_textfilters.rb +++ /dev/null @@ -1,33 +0,0 @@ -class Bare13TextFilter < ActiveRecord::Base - include BareMigration -end - -class AddTextfilters < ActiveRecord::Migration - def self.up - say "Adding TextFilters table" - Bare13TextFilter.transaction do - create_table :text_filters do |t| - t.column :name, :string - t.column :description, :string - t.column :markup, :string - t.column :filters, :text - t.column :params, :text - end - - Bare13TextFilter.create(:name => 'none', :description => 'None', - :markup => 'none', :filters => [], :params => {}) - Bare13TextFilter.create(:name => 'markdown', :description => 'Markdown', - :markup => "markdown", :filters => [], :params => {}) - Bare13TextFilter.create(:name => 'smartypants', :description => 'SmartyPants', - :markup => 'none', :filters => [:smartypants], :params => {}) - Bare13TextFilter.create(:name => 'markdown smartypants', :description => 'Markdown with SmartyPants', - :markup => 'markdown', :filters => [:smartypants], :params => {}) - Bare13TextFilter.create(:name => 'textile', :description => 'Textile', - :markup => 'textile', :filters => [], :params => {}) - end - end - - def self.down - drop_table :text_filters - end -end diff --git a/db/migrate/014_move_text_filter_to_text_filter_id.rb b/db/migrate/014_move_text_filter_to_text_filter_id.rb deleted file mode 100644 index 7c8875d692..0000000000 --- a/db/migrate/014_move_text_filter_to_text_filter_id.rb +++ /dev/null @@ -1,43 +0,0 @@ -class MoveTextFilterToTextFilterId < ActiveRecord::Migration - class BareArticle < ActiveRecord::Base - include BareMigration - end - - class BarePage < ActiveRecord::Base - include BareMigration - end - - class BareTextFilter < ActiveRecord::Base - include BareMigration - end - - def self.up - say "Converting Article and Page to use text_filter_id instead of text_filter" - id_of = BareTextFilter.find(:all).inject({}) {|h, f| h.merge({ h[f.name] => f.id }) } - - modify_tables_and_update([:add_column, BareArticle, :text_filter_id, :integer], - [:add_column, BarePage, :text_filter_id, :integer]) do - (BareArticle.find(:all) + BarePage.find(:all)).each do |content| - content.text_filter_id = id_of[content.attributes['text_filter']] - content.save! - end - end - remove_column :articles, :text_filter - remove_column :pages, :text_filter - end - - def self.down - say "Dropping text_filter_id in favor of text_filter" - name_of = BareTextFilter.find(:all).inject({}) {|h, f| h.merge({ h[f.id] => f.name })} - - modify_tables_and_update([:add_column, BareArticle, :text_filter, :string], - [:add_column, BarePage, :text_filter, :string]) do - (BareArticle.find(:all) + BarePage.find(:all)).each do |content| - content.attributes['text_filter'] = name_of[content.text_filter_id] - content.save! - end - end - remove_column :articles, :text_filter_id - remove_column :pages, :text_filter_id - end -end diff --git a/db/migrate/015_convert_mysql_to_innodb.rb b/db/migrate/015_convert_mysql_to_innodb.rb deleted file mode 100644 index f88b1d2ee5..0000000000 --- a/db/migrate/015_convert_mysql_to_innodb.rb +++ /dev/null @@ -1,19 +0,0 @@ -class ConvertMysqlToInnodb < ActiveRecord::Migration - def self.up - config = ActiveRecord::Base.configurations - begin - say "Migrating all existing tables to InnoDB" - schema = [] - select_all('SHOW TABLES').map do |table| - "ALTER TABLE #{table.to_a.first.last} ENGINE=InnoDB" - end - schema.each { |line| execute line } - end if config[::Rails.env]['adapter'] == 'mysql' unless $schema_generator - end - - def self.down - # don't do anything - # this is a one-way migration, but it's not "irreversable" - # because it doesn't change any code logic - end -end diff --git a/db/migrate/016_fix_is_primary_postgres.rb b/db/migrate/016_fix_is_primary_postgres.rb deleted file mode 100644 index ee22b68a7d..0000000000 --- a/db/migrate/016_fix_is_primary_postgres.rb +++ /dev/null @@ -1,16 +0,0 @@ -# The PostgreSQL schema for 2.0.6 differs from the MySQL schema-- -# pgsql had articles_categories.primary_item, while mysql had -# articles_categories.is_primary. More modenen schemas all have is_primary. -# This will break Postgres upgrades from 2.0.6, and apparently it bit #375. - -# Since we've removed the pointless articles_categories table from the migration -# we don't need to fix it up :) - -class FixIsPrimaryPostgres < ActiveRecord::Migration - def self.up - - end - - def self.down - end -end diff --git a/db/migrate/017_add_comment_user_id.rb b/db/migrate/017_add_comment_user_id.rb deleted file mode 100644 index d4f4820974..0000000000 --- a/db/migrate/017_add_comment_user_id.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AddCommentUserId < ActiveRecord::Migration - class BareComment < ActiveRecord::Base - include BareMigration - end - - class BareUser < ActiveRecord::Base - include BareMigration - end - - def self.up - id_for_address = BareUser.find(:all).inject({}) do |h, u| - h.merge({ u.email => u.id }) - end - - modify_tables_and_update(:add_column, BareComment, :user_id, :integer) do |c| - c.user_id = id_for_address[c.email] - end - end - - def self.down - remove_column :comments, :user_id - end -end diff --git a/db/migrate/018_add_guids.rb b/db/migrate/018_add_guids.rb deleted file mode 100644 index 10fd1871b6..0000000000 --- a/db/migrate/018_add_guids.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddGuids < ActiveRecord::Migration - def self.up - say "Adding GUIDs to Comments and Trackbacks" - - modify_tables_and_update([:add_column, :comments, :guid, :string], - [:add_column, :trackbacks, :guid, :string]) - end - - def self.down - remove_column :comments, :guid - remove_column :trackbacks, :guid - end -end diff --git a/db/migrate/019_add_whiteboards_to_content.rb b/db/migrate/019_add_whiteboards_to_content.rb deleted file mode 100644 index a368b43369..0000000000 --- a/db/migrate/019_add_whiteboards_to_content.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddWhiteboardsToContent < ActiveRecord::Migration - def self.up - say "Adding whiteboard to articles, comments and pages" - modify_tables_and_update([:add_column, :articles, :whiteboard, :text], - [:add_column, :comments, :whiteboard, :text], - [:add_column, :pages, :whiteboard, :text]) - end - - def self.down - say "Removing whiteboard from articles, comments and pages" - remove_column :articles, :whiteboard - remove_column :comments, :whiteboard - remove_column :pages, :whiteboard - end -end diff --git a/db/migrate/020_superclass_articles.rb b/db/migrate/020_superclass_articles.rb deleted file mode 100644 index a95cf7a9f8..0000000000 --- a/db/migrate/020_superclass_articles.rb +++ /dev/null @@ -1,168 +0,0 @@ -class Bare20Article < ActiveRecord::Base - include BareMigration - - # need to point the primary key somewhere else so we can manually - # set this field for each article. - #set_primary_key :boguskey -end - -class Bare20Content < ActiveRecord::Base - include BareMigration - -# From active_record/base.rb: "the primary key and inheritance column can -# never be set by mass-assignment for security reasons." Because this -# script wants to set 'id' and 'type', we need to fool activerecord by -# setting them to bogus values. - set_inheritance_column :bogustype - #set_primary_key :boguskey -end - -class SuperclassArticles < ActiveRecord::Migration - def self.config - ActiveRecord::Base.configurations - end - - def self.up - say "Merging Articles into Contents table" - - # Make sure our index is in a known state - # Comment because in migration 001, there are already a creation of this index - #add_index :articles, :permalink rescue nil - - Bare20Article.transaction do - create_table :contents do |t| -# ActiveRecord::Base.connection.send(:create_table, [:contents]) do |t| - t.column :type, :string - t.column :title, :string - t.column :author, :string - t.column :body, :text - t.column :body_html, :text - t.column :extended, :text - t.column :excerpt, :text - t.column :keywords, :string - t.column :allow_comments, :integer - t.column :allow_pings, :integer - t.column :published, :integer, :default => 1 - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :extended_html, :text - t.column :user_id, :integer - t.column :permalink, :string - t.column :guid, :string - t.column :text_filter_id, :integer - t.column :whiteboard, :text - end - - if config[::Rails.env]['adapter'] == 'postgresql' - execute "select nextval('contents_id_seq')" - end - - if not $schema_generator - - Bare20Article.find(:all).each do |a| - t = Bare20Content.new( - :type => 'Article', - :title => a.title, - :author => a.author, - :body => a.body, - :body_html => a.body_html, - :extended => a.extended, - :excerpt => a.excerpt, - :keywords => a.keywords, - :allow_comments => a.allow_comments, - :allow_pings => a.allow_pings, - :published => a.published, - :created_at => a.created_at, - :updated_at => a.updated_at, - :extended_html => a.extended_html, - :user_id => a.user_id, - :permalink => a.permalink, - :guid => a.guid, - :text_filter_id => a.text_filter_id, - :whiteboard => a.whiteboard) - # can't use id accessor because it uses the bogus primary key - t.send(:write_attribute, :id, a.send(:read_attribute, :id)) - t.save! - end - - if config[::Rails.env]['adapter'] == 'postgresql' - say "Resetting PostgreSQL sequences", true - execute "select setval('contents_id_seq',max(id)) from contents" - execute "select nextval('contents_id_seq')" - end - end - - remove_index :articles, :permalink - drop_table :articles - end - end - - def self.down - Bare20Content.transaction do - say "Recreating Articles from Contents table." - - create_table :articles do |t| - t.column :title, :string - t.column :author, :string - t.column :body, :text - t.column :body_html, :text - t.column :extended, :text - t.column :excerpt, :text - t.column :keywords, :string - t.column :allow_comments, :integer - t.column :allow_pings, :integer - t.column :published, :integer, :default => 1 - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :extended_html, :text - t.column :user_id, :integer - t.column :permalink, :string - t.column :guid, :string - t.column :text_filter_id, :integer - t.column :whiteboard, :text - end - - if config[::Rails.env]['adapter'] == 'postgresql' - execute "select nextval('articles_id_seq')" - end - - add_index :articles, :permalink - - if not $schema_generator - Bare20Content.find(:all, :conditions => "type = 'Article'").each do |a| - t = Bare20Article.new( - :title => a.title, - :author => a.author, - :body => a.body, - :body_html => a.body_html, - :extended => a.extended, - :excerpt => a.excerpt, - :keywords => a.keywords, - :allow_comments => a.allow_comments, - :allow_pings => a.allow_pings, - :published => a.published, - :created_at => a.created_at, - :updated_at => a.updated_at, - :extended_html => a.extended_html, - :user_id => a.user_id, - :permalink => a.permalink, - :guid => a.guid, - :text_filter_id => a.text_filter_id, - :whiteboard => a.whiteboard) - # can't use id accessor because it uses the bogus primary key - t.send(:write_attribute, :id, a.send(:read_attribute, :id)) - t.save! - end - - if config[::Rails.env]['adapter'] == 'postgres' - say "Resetting PostgreSQL sequences", true - execute "select setval('articles_id_seq',max(id)+1) from articles" - end - - end - - # script 21 saved the comments, this script saved the articles. - drop_table :contents - end - end -end diff --git a/db/migrate/021_superclass_comments.rb b/db/migrate/021_superclass_comments.rb deleted file mode 100644 index 7c48d1354a..0000000000 --- a/db/migrate/021_superclass_comments.rb +++ /dev/null @@ -1,94 +0,0 @@ -class SuperclassComments < ActiveRecord::Migration - class BareComment < ActiveRecord::Base - include BareMigration - end - - class BareContent < ActiveRecord::Base - include BareMigration - set_inheritance_column :bogustype # see migration #20 for why - end - - def self.up - say "Merging Comments into Contents table" - # Get our indices into a known good state. - # Mutter dark imprecations at having to do this. - #add_index(:comments, :article_id) rescue nil - #remove_index(:contents, :article_id) rescue nil - modify_tables_and_update([:add_column, BareContent, :article_id, :integer], - [:add_column, BareContent, :email, :string ], - [:add_column, BareContent, :url, :string ], - [:add_column, BareContent, :ip, :string ], - [:add_index, BareContent, :article_id ]) do - BareContent.transaction do - if not $schema_generator - BareComment.find(:all).each do |c| - BareContent.create!(:type => 'Comment', - :article_id => c.article_id, - :author => c.author, - :email => c.email, - :url => c.url, - :ip => c.ip, - :body => c.body, - :body_html => c.body_html, - :created_at => c.created_at, - :updated_at => c.updated_at, - :user_id => c.user_id, - :guid => c.guid, - :whiteboard => c.whiteboard) - end - end - end - remove_index(:comments, :article_id) - end - drop_table :comments - end - - def self.init_comments_table(t) - t.column :article_id, :integer - t.column :title, :string - t.column :author, :string - t.column :email, :string - t.column :url, :string - t.column :ip, :string - t.column :body, :text - t.column :body_html, :text - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :user_id, :integer - t.column :guid, :string - t.column :whiteboard, :text - end - - - def self.down - say "Recreating Comments from Contents table" - modify_tables_and_update([:create_table, BareComment, lambda {|t| self.init_comments_table(t)}], - [:add_index, BareComment, :article_id ]) do - BareContent.transaction do - BareComment.transaction do - BareContent.find(:all, :conditions => "type = 'Comment'").each do |c| - BareComment.create!(:article_id => c.article_id, - :title => c.title, - :author => c.author, - :email => c.email, - :url => c.url, - :ip => c.ip, - :body => c.body, - :body_html => c.body_html, - :created_at => c.created_at, - :updated_at => c.updated_at, - :user_id => c.user_id, - :guid => c.guid, - :whiteboard => c.whiteboard) - end - BareContent.delete_all "type = 'Comment'" - end - end - remove_index :contents, :article_id - remove_column :contents, :article_id - remove_column :contents, :email - remove_column :contents, :url - remove_column :contents, :ip - end - end -end diff --git a/db/migrate/022_superclass_trackbacks.rb b/db/migrate/022_superclass_trackbacks.rb deleted file mode 100644 index f62db8d454..0000000000 --- a/db/migrate/022_superclass_trackbacks.rb +++ /dev/null @@ -1,73 +0,0 @@ -class SuperclassTrackbacks < ActiveRecord::Migration - class BareContent < ActiveRecord::Base - include BareMigration - set_inheritance_column :bogustype # see migration #20 for why - end - - class BareTrackback < ActiveRecord::Base - include BareMigration - end - - def self.up - say "Merging Trackbacks into Content table" - # Ensure that the index we're going to remove in the transaction - # is actually there (otherwise Postgres breaks) - # Comment because already in migration 001 - #add_index(:trackbacks, :article_id) rescue nil - modify_tables_and_update([:add_column, BareContent, :blog_name, :string], - [:remove_index, BareTrackback, :article_id ]) do - BareContent.transaction do - if not $schema_generator - BareTrackback.find(:all).each do |tb| - a = BareContent.find(tb.article_id) - BareContent.create(:type => 'Trackback', - :article_id => tb.article_id, - :blog_name => tb.blog_name, - :title => tb.title, - :excerpt => tb.excerpt, - :url => tb.url, - :ip => tb.ip, - :created_at => tb.created_at, - :updated_at => tb.updated_at, - :guid => tb.guid) - end - end - end - end - drop_table :trackbacks - end - - def self.transactions_init(t) - t.column :article_id, :integer - t.column :blog_name, :string - t.column :title, :string - t.column :excerpt, :string - t.column :url, :string - t.column :ip, :string - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :guid, :string - end - - def self.down - say "Recreating Trackbacks from Contents table" - modify_tables_and_update([:create_table, :trackbacks, lambda {|t| transactions_init(t)}], - [:add_index, :trackbacks, :article_id]) do - BareContent.transaction do - BareContent.find(:all, :conditions => ["type = ?", 'Trackback']).each do |tb| - BareTrackback.create(:article_id => tb.article_id, - :blog_name => tb.blog_name, - :title => tb.title, - :excerpt => tb.excerpt, - :url => tb.url, - :ip => tb.ip, - :created_at => tb.created_at, - :updated_at => tb.updated_at, - :guid => tb.guid) - end - BareContent.delete_all("type = 'Trackback'") - end - end - remove_column :contents, :blog_name - end -end diff --git a/db/migrate/023_superclass_pages.rb b/db/migrate/023_superclass_pages.rb deleted file mode 100644 index 62cabb58cb..0000000000 --- a/db/migrate/023_superclass_pages.rb +++ /dev/null @@ -1,65 +0,0 @@ -class Bare23Content < ActiveRecord::Base - include BareMigration - set_inheritance_column :bogustype # see migration #20 for why -end - -class Bare23Page < ActiveRecord::Base - include BareMigration -end - -class SuperclassPages < ActiveRecord::Migration - def self.up - say "Merging Pages into Content table" - modify_tables_and_update(:add_column, Bare23Content, :name, :string) do - Bare23Content.transaction do - if not $schema_generator - Bare23Page.find(:all).each do |p| - Bare23Content.create(:type => 'Page', - :name => p.name, - :user_id => p.user_id, - :body => p.body, - :body_html => p.body_html, - :created_at => p.created_at, - :updated_at => (p.modified_at rescue p.updated_at), - :title => p.title, - :text_filter_id => p.text_filter_id) - end - end - end - end - drop_table :pages - end - - def self.init_pages(t) - t.column :name, :string - t.column :user_id, :integer - t.column :body, :text - t.column :body_html, :text - t.column :created_at, :datetime - t.column :updated_at, :datetime - t.column :title, :string - t.column :text_filter_id, :integer - t.column :whiteboard, :text - end - - def self.down - say "Recreating pages table" - modify_tables_and_update(:create_table, :pages, lambda {|t| init_pages(t)}) do - Bare23Content.transaction do - Bare23Content.find(:all, :conditions => "type = 'Page'").each do |p| - Bare23Page.create(:name => p.name, - :user_id => p.user_id, - :body => p.body, - :body_html => p.body_html, - :created_at => p.created_at, - :updated_at => p.updated_at, - :title => p.title, - :text_filter_id => p.text_filter_id, - :whiteboard => p.whiteboard) - end - Bare23Content.delete_all "type = 'Page'" - end - end - remove_column :contents, :name - end -end diff --git a/db/migrate/024_cleanup_contents.rb b/db/migrate/024_cleanup_contents.rb deleted file mode 100644 index e49ca7bd42..0000000000 --- a/db/migrate/024_cleanup_contents.rb +++ /dev/null @@ -1,44 +0,0 @@ -# BareMigration doesn't handle inheritance yet. Therefore, we need -# to mimic it manually using conditions on find(). Since this script -# doesn't need to set type or id, there's no need to move either of -# the protected fields out of the way like we do in #20-23. - -# BareMigration ALSO doesn't handle associations... yet. -# For now, that means your keywords won't be automatically converted -# to tags. That might not be a bad thing... - - -class Bare24Article < ActiveRecord::Base - include BareMigration - include TypoGuid - - set_table_name :contents - has_and_belongs_to_many :tags, - :class_name => 'Bare24Tag', :foreign_key => 'article_id', - :join_table => 'articles_tags', :association_foreign_key => 'tag_id' -end - -class Bare24Tag < ActiveRecord::Base - include BareMigration - has_and_belongs_to_many :articles, - :class_name => 'Bare24Article', :foreign_key => 'tag_id', - :join_table => 'articles_tags', :association_foreign_key => 'articles_id' -end - -class CleanupContents < ActiveRecord::Migration - def self.up - say "Updating all articles" - # This is needed when migrating from 2.5.x, because we skip GUID - # generation and tagging during earlier migrations. - Bare24Article.transaction do - Bare24Article.find(:all, :conditions => "type = 'Article'").each do |a| - a.create_guid - a.save! - end - end - end - - def self.down - # nothing - end -end diff --git a/db/migrate/025_add_itunes_metadata.rb b/db/migrate/025_add_itunes_metadata.rb deleted file mode 100644 index e8f8f272d6..0000000000 --- a/db/migrate/025_add_itunes_metadata.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Bare25Resource < ActiveRecord::Base - include BareMigration -end - -class AddItunesMetadata < ActiveRecord::Migration - def self.up - say "Adding podcast metadata fields" - modify_tables_and_update([:add_column, :resources, :itunes_metadata, :boolean], - [:add_column, :resources, :itunes_author, :string], - [:add_column, :resources, :itunes_subtitle, :string], - [:add_column, :resources, :itunes_duration, :integer], - [:add_column, :resources, :itunes_summary, :text], - [:add_column, :resources, :itunes_keywords, :string], - [:add_column, :resources, :itunes_category, :string], - [:add_column, :resources, :itunes_explicit, :boolean]) - end - - def self.down - say "Removing podcast metadata fields" - modify_tables_and_update([:remove_column, :resources, :itunes_metadata, :boolean], - [:remove_column, :resources, :itunes_author, :string], - [:remove_column, :resources, :itunes_subtitle, :string], - [:remove_column, :resources, :itunes_duration, :integer], - [:remove_column, :resources, :itunes_summary, :text], - [:remove_column, :resources, :itunes_keywords, :string], - [:remove_column, :resources, :itunes_category, :string], - [:remove_column, :resources, :itunes_explicit, :boolean]) - end -end diff --git a/db/migrate/026_add_redirect_table.rb b/db/migrate/026_add_redirect_table.rb deleted file mode 100644 index b66bacf283..0000000000 --- a/db/migrate/026_add_redirect_table.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddRedirectTable < ActiveRecord::Migration - def self.up - say "Adding Redirect Table" - create_table :redirects do |t| - t.column :from_path, :string - t.column :to_path, :string - end - end - - def self.down - drop_table :redirects - end -end diff --git a/db/migrate/027_set_comment_published_flag.rb b/db/migrate/027_set_comment_published_flag.rb deleted file mode 100644 index c6bfbf66e0..0000000000 --- a/db/migrate/027_set_comment_published_flag.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Bare27Content < ActiveRecord::Base - include BareMigration - # See #24 for a description of how we have to manually handle STI -end - -class SetCommentPublishedFlag < ActiveRecord::Migration - def self.up - say "Setting published flag on each comment" - Bare27Content.transaction do - Bare27Content.find(:all, :conditions => "type = 'Comment'").each do |c| - c.published = true - c.save! - end - end - end - - def self.down - end -end diff --git a/db/migrate/028_rename_redirect_to.rb b/db/migrate/028_rename_redirect_to.rb deleted file mode 100644 index 59d9b9fd3f..0000000000 --- a/db/migrate/028_rename_redirect_to.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Bare28Redirect < ActiveRecord::Base - include BareMigration -end - -class RenameRedirectTo < ActiveRecord::Migration - def self.up - # The original version of the redirects table used 'to' as a column name - # Postgres is okay with that, but not mysql. - # You need test if rename needed, because with migration transaction, all - # failed if rename failed - if Bare28Redirect.columns_hash.has_key? 'to' - rename_column :redirects, :to, :to_path - end - end - - def self.down - # don't rename column back to broken name. - # there's little chance this column will be used before now anyway. - end -end diff --git a/db/migrate/029_add_user_notification.rb b/db/migrate/029_add_user_notification.rb deleted file mode 100644 index 85deb33ea4..0000000000 --- a/db/migrate/029_add_user_notification.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Bare29User < ActiveRecord::Base - include BareMigration -end - -class AddUserNotification < ActiveRecord::Migration - def self.up - modify_tables_and_update([:add_column, Bare29User, :notify_via_email, :boolean], - [:add_column, Bare29User, :notify_on_new_articles, :boolean], - [:add_column, Bare29User, :notify_on_comments, :boolean], - [:add_column, Bare29User, :notify_watch_my_articles, :boolean]) do |u| - # Definitions: - # notify_via_email: use email to deliver notifications - # notify_on_new_articles: send a notification message (email, etc) when new articles added. - # notify_on_comments: send a notification message when new comments are added to watched articles. - # notify_watch_my_articles: tell the notifiation system to watch my articles. - u.notify_via_email = true - u.notify_on_new_articles = false - u.notify_on_comments = true - u.notify_watch_my_articles = true - end - end - - def self.down - modify_tables_and_update([:remove_column, Bare29User, :notify_via_email, :boolean], - [:remove_column, Bare29User, :notify_on_new_articles, :boolean], - [:remove_column, Bare29User, :notify_on_comments, :boolean], - [:remove_column, Bare29User, :notify_watch_my_articles, :boolean]) - end -end diff --git a/db/migrate/030_index_sessions.rb b/db/migrate/030_index_sessions.rb deleted file mode 100644 index 30a2881de8..0000000000 --- a/db/migrate/030_index_sessions.rb +++ /dev/null @@ -1,9 +0,0 @@ -class IndexSessions < ActiveRecord::Migration - def self.up - add_index :sessions, :sessid - end - - def self.down - remove_index :sessions, :sessid - end -end diff --git a/db/migrate/031_add_notifications_table.rb b/db/migrate/031_add_notifications_table.rb deleted file mode 100644 index 156c574f57..0000000000 --- a/db/migrate/031_add_notifications_table.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AddNotificationsTable < ActiveRecord::Migration - def self.up - create_table :notifications, :id => false do |t| - t.column :notify_user_id, :integer - t.column :notify_content_id, :integer - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - end - - def self.down - drop_table :notifications - end -end diff --git a/db/migrate/032_add_jabber_notification.rb b/db/migrate/032_add_jabber_notification.rb deleted file mode 100644 index cf2b3d37d1..0000000000 --- a/db/migrate/032_add_jabber_notification.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddJabberNotification < ActiveRecord::Migration - def self.up - add_column :users, :notify_via_jabber, :boolean - add_column :users, :jabber, :string - end - - def self.down - remove_column :users, :notify_via_jabber - remove_column :users, :jabber - end -end diff --git a/db/migrate/033_add_count_caching.rb b/db/migrate/033_add_count_caching.rb deleted file mode 100644 index c3fcb0f0c3..0000000000 --- a/db/migrate/033_add_count_caching.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Bare33Content < ActiveRecord::Base - include BareMigration - - def count_children_of_type(type) - self.class.find(:all, - :conditions => ["article_id = ? and type = ?", - self.id, type ]).size - end - - def correct_counts - self.comments_count = self.count_children_of_type('Comment') - self.trackbacks_count = self.count_children_of_type('Trackback') - end -end - - -class AddCountCaching < ActiveRecord::Migration - def self.up - say "Adding comments_count, trackbacks_count" - modify_tables_and_update([:add_column, Bare33Content, :comments_count, :integer], - [:add_column, Bare33Content, :trackbacks_count, :integer]) do |a| - if not $schema_generator - a.correct_counts - end - end - end - - def self.down - say "Removing counts columns" - remove_column :contents, :comments_count - remove_column :contents, :trackbacks_count - end -end - diff --git a/db/migrate/034_boolify_published.rb b/db/migrate/034_boolify_published.rb deleted file mode 100644 index fa340ed69b..0000000000 --- a/db/migrate/034_boolify_published.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Bare34Content < ActiveRecord::Base - include BareMigration -end - -class BoolifyPublished < ActiveRecord::Migration - def self.up - say "Boolifying contents.published" - modify_tables_and_update([:rename_column, Bare34Content, :published, :old_pub], - [:add_column, Bare34Content, :published, :boolean, { :default => true }]) do |c| - unless $schema_generator - if c.old_pub.nil? - c.published = true - else - c.published = (!c.old_pub.to_i.zero? ? true : false) - end - end - end - remove_column :contents, :old_pub - end - - def self.down - say "Un-Boolifying contents.published" - modify_tables_and_update([:rename_column, Bare34Content, :published, :old_pub], - [:add_column, Bare34Content, :published, :integer]) do |c| - unless $schema_generator - say "Old published: #{c.old_pub}" - if c.old_pub.nil? - c.published = 1 - else - c.published = c.old_pub ? 1 : 0 - end - end - end - remove_column :contents, :old_pub - end -end diff --git a/db/migrate/035_boolify_content_allow_foo.rb b/db/migrate/035_boolify_content_allow_foo.rb deleted file mode 100644 index e67db62649..0000000000 --- a/db/migrate/035_boolify_content_allow_foo.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Bare35Content < ActiveRecord::Base - include BareMigration -end - -class BoolifyContentAllowFoo < ActiveRecord::Migration - def self.up - say "Boolifying contents.allow_(comments|pings)" - - modify_tables_and_update([:rename_column, Bare35Content, :allow_pings, :old_ap], - [:add_column, Bare35Content, :allow_pings, :boolean], - [:rename_column, Bare35Content, :allow_comments, :old_ac], - [:add_column, Bare35Content, :allow_comments, :boolean]) do |c| - unless $schema_generator - c.allow_pings = !c.old_ap.to_i.zero? ? true : false unless c.old_ap.nil? - c.allow_comments = !c.old_ac.to_i.zero? ? true : false unless c.old_ac.nil? - end - end - remove_column :contents, :old_ap - remove_column :contents, :old_ac - end - - def self.down - say "Un-Boolifying contents.allow_(comments|pings)" - modify_tables_and_update([:rename_column, Bare35Content, :allow_pings, :old_ap], - [:add_column, Bare35Content, :allow_pings, :integer], - [:rename_column, Bare35Content, :allow_comments, :old_ac], - [:add_column, Bare35Content, :allow_comments, :integer]) do |c| - unless $schema_generator - c.allow_pings = c.old_ap ? 1 : 0 unless c.old_ap.nil? - c.allow_comments = c.old_ac ? 1 : 0 unless c.old_ac.nil? - end - end - remove_column :contents, :old_ap - remove_column :contents, :old_ac - end -end diff --git a/db/migrate/036_add_tag_display_name.rb b/db/migrate/036_add_tag_display_name.rb deleted file mode 100644 index 731fb3c565..0000000000 --- a/db/migrate/036_add_tag_display_name.rb +++ /dev/null @@ -1,51 +0,0 @@ -class AddTagDisplayName < ActiveRecord::Migration - class Tag < ActiveRecord::Base - has_and_belongs_to_many :articles - end - - class Content < ActiveRecord::Base - end - - class Article < Content - has_and_belongs_to_many :tags - end - - def self.up - say 'Adding display name to tags' - modify_tables_and_update(:add_column, Tag, :display_name, :string) do - unless $schema_generator - Tag.find(:all).each do |tag| - tag.display_name = tag.name - tag.name = tag.name.tr(' ', '').downcase - if tag.name != tag.display_name - # we need to make sure we're not attempting to create duplicate-named tags - # if so, we need to coalesce them - # Hopefully this code isn't necessary, but somebody may have tags "Monty Python" and "montypython" - # Please note that this code isn't going to be tested very well, if at all, because of my limited - # testing setup. But in my quickie tests it appears to be working right - if origtag = Tag.find(:first, :conditions => [%{name = ? AND id != ?}, tag.name, tag.id]) - tag.articles.each do |article| - # replace our tag with origtag in article.tags - article.tags = article.tags.collect { |x| x.id == tag.id ? origtag : x } - end - tag.destroy - else - # ok, original tag - tag.save! - end - else - tag.save! - end - end - end - end - end - - def self.down - say 'Removing display name from tags' - unless $schema_generator - Tag.update_all('name = display_name') - end - remove_column :tags, :display_name - end -end diff --git a/db/migrate/037_enlarge_ip_field.rb b/db/migrate/037_enlarge_ip_field.rb deleted file mode 100644 index beadc8bcce..0000000000 --- a/db/migrate/037_enlarge_ip_field.rb +++ /dev/null @@ -1,9 +0,0 @@ -class EnlargeIpField < ActiveRecord::Migration - def self.up - change_column :contents, :ip, :string, :limit => 40 - end - - def self.down - change_column :contents, :ip, :string - end -end diff --git a/db/migrate/038_add_blog_object.rb b/db/migrate/038_add_blog_object.rb deleted file mode 100644 index 6c77b5d94f..0000000000 --- a/db/migrate/038_add_blog_object.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Bare38Blog < ActiveRecord::Base - include BareMigration -end - -class Bare38Setting < ActiveRecord::Base - include BareMigration -end - -class AddBlogObject < ActiveRecord::Migration - def self.up - begin - say "Adding a blogs table" - create_table :blogs do |t| - t.column :dummy, :string unless $schema_generator - end - unless $schema_generator - Bare38Blog.reset_column_information - - add_column :settings, :blog_id, :integer - Bare38Setting.reset_column_information - - Bare38Setting.transaction do - say "Creating default blog", true - default_blog = Bare38Blog.create! - - say "Connecting settings to the default blog", true - - say "New Default blog has id: " + default_blog.id.to_s, true - say "Migrating #{Bare38Setting.find(:all).size} settings to the new Blog", true - - Bare38Setting.find(:all).each do |setting| - setting.blog_id = default_blog.id - setting.save! - end - end - remove_column :blogs, :dummy - end - rescue Exception => e - say("Rolling back the changes") - drop_table(:blogs) rescue nil - remove_column(:settings, :blog_id) rescue nil - raise e - end - end - - def self.down - say "Unlinking settings and removing the blogs table" - Bare38Setting.delete_all(["blog_id != ?", Bare38Blog.find(:first)]) - remove_column :settings, :blog_id - drop_table :blogs - end -end diff --git a/db/migrate/039_serialize_blog_attributes.rb b/db/migrate/039_serialize_blog_attributes.rb deleted file mode 100644 index 16ea464061..0000000000 --- a/db/migrate/039_serialize_blog_attributes.rb +++ /dev/null @@ -1,167 +0,0 @@ -class SerializeBlogAttributes < ActiveRecord::Migration - class BareSetting < ActiveRecord::Base - include BareMigration - belongs_to :blog, :class_name => "SerializeBlogAttributes::BareBlog" - - def self.with_blog_scope(id, &block) - options = {} - options[:conditions] = ["blog_id = ?", id] - with_scope(:find => options, &block) - end - - end - - class BareBlog < ActiveRecord::Base - include BareMigration - serialize :settings - - class SettingSpec - attr_accessor :key, :type, :default - - def initialize(key, type, default) - self.key = key - self.type = type - self.default = default - end - - def normalize_value(line) - if !line || line.value.nil? - return default - end - value = line.value - case type - when :boolean - ! value.match(/^(?:f(?:alse)?|0|)$/) - when :integer - value.to_i - when :string - value - else - YAML::load(value) - end - end - - def stringify_value(value) - case type - when :boolean - value.to_s - when :integer - value.to_s - when :string - value - else - value.to_yaml - end - end - end - - def self.fields(key = nil) - @@fields ||= { } - key ? @@fields[key.to_sym] : @@fields - end - - def self.setting(key, type, default) - fields[key.to_sym] = SettingSpec.new(key.to_sym, type, default) - end - - # Description - setting :blog_name, :string, 'My Shiny Weblog!' - setting :blog_subtitle, :string, '' - setting :geourl_location, :string, '' - - # Spam - setting :sp_global, :boolean, false - setting :sp_article_auto_close, :integer, 0 - setting :sp_allow_non_ajax_comments, :boolean, true - setting :sp_url_limit, :integer, 0 - - # Podcasting - setting :itunes_explicit, :boolean, false - setting :itunes_author, :string, '' - setting :itunes_subtitle, :string, '' - setting :itunes_summary, :string, '' - setting :itunes_owner, :string, '' - setting :itunes_email, :string, '' - setting :itunes_name, :string, '' - setting :itunes_copyright, :string, '' - - # Mostly Behaviour - setting :text_filter, :string, '' - setting :comment_text_filter, :string, '' - setting :limit_article_display, :integer, 10 - setting :limit_rss_display, :integer, 10 - setting :default_allow_pings, :boolean, false - setting :default_allow_comments, :boolean, true - setting :link_to_author, :boolean, false - setting :show_extended_on_rss, :boolean, true - setting :theme, :string, 'azure' - setting :use_gravatar, :boolean, false - setting :ping_urls, :string, "http://rpc.technorati.com/rpc/ping\nhttp://ping.blo.gs/\nhttp://rpc.weblogs.com/RPC2" - setting :send_outbound_pings, :boolean, true - setting :email_from, :string, 'scott@sigkill.org' - - # Jabber config - setting :jabber_address, :string, '' - setting :jabber_password, :string, '' - end - - - def self.up - add_column :blogs, :settings, :text - unless $schema_generator - begin - BareSetting.transaction do - BareBlog.find(:all).each do |blog| - blog.settings = { } - BareSetting.with_blog_scope(blog.id) do - BareBlog.fields.each do |key, spec| - next unless setting = BareSetting.find_by_name(key.to_s, :limit => 1) - blog.settings[key.to_s] = - spec.normalize_value(setting) - BareSetting.delete(setting.id) - end - end - blog.save - end - end - rescue Exception => e - remove_column :blogs, :settings rescue nil - raise e - end - end - drop_table :settings - end - - def self.down - begin - create_settings - unless $schema_generator - BareSetting.transaction do - BareBlog.find(:all).each do |blog| - blog.settings ||= { } - BareSetting.with_scope(:create => { :blog_id => blog.id }) do - BareBlog.fields.each do |key, spec| - next unless blog.settings.has_key?(key.to_s) - BareSetting.create!(:name => key.to_s, - :value => spec.stringify_value(blog.settings[key.to_s])) - end - end - end - end - end - remove_column :blogs, :settings rescue nil - rescue Exception => e - drop_table :settings rescue nil - raise e - end - end - - def self.create_settings - create_table :settings do |t| - t.column :name, :string, :limit => 255 - t.column :value, :string, :limit => 255 - t.column :position, :integer - t.column :blog_id, :integer - end - end -end diff --git a/db/migrate/040_attach_content_to_blog.rb b/db/migrate/040_attach_content_to_blog.rb deleted file mode 100644 index 4c20216bb6..0000000000 --- a/db/migrate/040_attach_content_to_blog.rb +++ /dev/null @@ -1,28 +0,0 @@ -class AttachContentToBlog < ActiveRecord::Migration - class BareContent < ActiveRecord::Base - include BareMigration - end - - class BareBlog < ActiveRecord::Base - include BareMigration - end - - def self.up - begin - add_column :contents, :blog_id, :integer - blog_id = BareBlog.find(:first).id - BareContent.find(:all).each {|c| c.blog_id = blog_id; c.save! } - change_column :contents, :blog_id, :integer, :null => false - add_index :contents, :blog_id - rescue Exception => e - remove_index :contents, :blog_id rescue nil - remove_column :contents, :blog_id rescue nil - raise e - end - end - - def self.down - remove_index :contents, :blog_id - remove_column :contents, :blog_id - end -end diff --git a/db/migrate/041_fixup_default_sidebars.rb b/db/migrate/041_fixup_default_sidebars.rb deleted file mode 100644 index 6cfd9f86a0..0000000000 --- a/db/migrate/041_fixup_default_sidebars.rb +++ /dev/null @@ -1,18 +0,0 @@ -class FixupDefaultSidebars < ActiveRecord::Migration - class BareSidebar < ActiveRecord::Base - include BareMigration - end - - def self.up - BareSidebar.transaction do - BareSidebar.find(:all, :conditions => "staged_position IS NULL").each do |sb| - sb.staged_position = sb.active_position; - sb.save! - end - end - end - - def self.down - # There's nothing to do in the down step. - end -end diff --git a/db/migrate/042_remove_sidebar_staged_config.rb b/db/migrate/042_remove_sidebar_staged_config.rb deleted file mode 100644 index 54f5db51b8..0000000000 --- a/db/migrate/042_remove_sidebar_staged_config.rb +++ /dev/null @@ -1,22 +0,0 @@ -class RemoveSidebarStagedConfig < ActiveRecord::Migration - class BareSidebar < ActiveRecord::Base - include BareMigration - serialize :active_config - serialize :staged_config - end - - - def self.up - remove_column :sidebars, :staged_config - rename_column :sidebars, :active_config, :config - end - - def self.down - modify_tables_and_update([:rename_column, BareSidebar, :config, :active_config], - [:add_column, BareSidebar, :staged_config, :text]) do |sb| - unless $schema_generator - sb.staged_config = sb.active_config - end - end - end -end diff --git a/db/migrate/043_create_triggers.rb b/db/migrate/043_create_triggers.rb deleted file mode 100644 index 30f245ff10..0000000000 --- a/db/migrate/043_create_triggers.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateTriggers < ActiveRecord::Migration - def self.up - create_table :triggers do |t| - t.column :pending_item_id, :integer - t.column :pending_item_type, :string - t.column :due_at, :datetime - t.column :trigger_method, :string - end - end - - def self.down - drop_table :triggers - end -end diff --git a/db/migrate/044_add_published_at_to_content.rb b/db/migrate/044_add_published_at_to_content.rb deleted file mode 100644 index cd1f6e8ed5..0000000000 --- a/db/migrate/044_add_published_at_to_content.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddPublishedAtToContent < ActiveRecord::Migration - class Content < ActiveRecord::Base - include BareMigration - end - - def self.up - modify_tables_and_update(:add_column, Content, - :published_at, :datetime) do |content| - unless $schema_generator - content.published_at = content.created_at - end - end - end - - def self.down - remove_column :contents, :published_at - end -end diff --git a/db/migrate/045_fix_contents_published_default.rb b/db/migrate/045_fix_contents_published_default.rb deleted file mode 100644 index bb94559cd2..0000000000 --- a/db/migrate/045_fix_contents_published_default.rb +++ /dev/null @@ -1,9 +0,0 @@ -class FixContentsPublishedDefault < ActiveRecord::Migration - def self.up - change_column :contents, :published, :boolean, :default => false - end - - def self.down - change_column :contents, :published, :boolean, :default => true - end -end diff --git a/db/migrate/046_fixup_forthcoming_publications.rb b/db/migrate/046_fixup_forthcoming_publications.rb deleted file mode 100644 index aa34f09cd4..0000000000 --- a/db/migrate/046_fixup_forthcoming_publications.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'bare_migration' -class FixupForthcomingPublications < ActiveRecord::Migration - class Trigger < ActiveRecord::Base - belongs_to :pending_item, :polymorphic => true - end - - class Content < ActiveRecord::Base - end - - class Article < Content - end - - def self.up - return if $schema_generator - Article.transaction do - Trigger.transaction do - Article.find(:all, :conditions => ['published = ? AND published_at > ?', - true, Time.now]).each do |art| - Trigger.create!(:pending_item => art, - :due_at => art.published_at, - :trigger_method => 'publish!') - art.update_attribute(:published, false) - end - end - end - end - - def self.down - return if $schema_generator - Article.transaction do - Trigger.transaction do - Trigger.find(:all, - :conditions => "pending_item_type = 'Article' AND trigger_method = 'publish!'").each do |t| - t.pending_item.update_attribute(:published, :true) - t.destroy - end - end - end - end -end diff --git a/db/migrate/047_add_content_state_field.rb b/db/migrate/047_add_content_state_field.rb deleted file mode 100644 index 5ed0638cf0..0000000000 --- a/db/migrate/047_add_content_state_field.rb +++ /dev/null @@ -1,24 +0,0 @@ -class AddContentStateField < ActiveRecord::Migration - class Content < ActiveRecord::Base - include BareMigration - end - - def self.up - modify_tables_and_update(:add_column, Content, - :state, :text) do |content| - unless $schema_generator - if content.published? - content.state = 'Published' - elsif content.published_at - content.state = 'PublicationPending' - else - content.state = 'Draft' - end - end - end - end - - def self.down - remove_column :contents, :state - end -end diff --git a/db/migrate/048_remove_count_caching.rb b/db/migrate/048_remove_count_caching.rb deleted file mode 100644 index 332fd1a077..0000000000 --- a/db/migrate/048_remove_count_caching.rb +++ /dev/null @@ -1,31 +0,0 @@ -class RemoveCountCaching < ActiveRecord::Migration - class Content < ActiveRecord::Base - include BareMigration - - def count_children_of_type(type) - self.class.find(:all, - :conditions => ["article_id = ? and type = ?", - self.id, type]).size - end - - def correct_counts - self.comments_count = self.count_children_of_type('Comment') - self.trackbacks_count = self.count_children_of_type('Trackback') - end - end - - def self.up - remove_column :contents, :comments_count - remove_column :contents, :trackbacks_count - end - - def self.down - modify_tables_and_update( - [:add_column, Content, :comments_count, :integer], - [:add_column, Content, :trackbacks_count, :integer]) do |a| - if not $schema_generator - a.correct_counts - end - end - end -end diff --git a/db/migrate/049_move_feedback_to_new_state_machine.rb b/db/migrate/049_move_feedback_to_new_state_machine.rb deleted file mode 100644 index 849e5c2fad..0000000000 --- a/db/migrate/049_move_feedback_to_new_state_machine.rb +++ /dev/null @@ -1,33 +0,0 @@ -class MoveFeedbackToNewStateMachine < ActiveRecord::Migration - class Content < ActiveRecord::Base - include BareMigration - end - - def self.up - return if $schema_generator - Content.find(:all, - :conditions => ['type = ? or type = ?', - 'Trackback', 'Comment']).each do |c| - c.state = if c.published? - 'ContentState::PresumedHam' - else - 'ContentState::PresumedSpam' - end - c.save! - end - end - - def self.down - return if $schema_generator - Content.find(:all, - :conditions => ['type = ? or type = ?', - 'Trackback', 'Comment']).each do |c| - c.state = if c.published? - 'ContentState::Published' - else - 'ContentState::Withdrawn' - end - c.save! - end - end -end diff --git a/db/migrate/050_add_status_confirmed_field_to_content.rb b/db/migrate/050_add_status_confirmed_field_to_content.rb deleted file mode 100644 index 989e545dc6..0000000000 --- a/db/migrate/050_add_status_confirmed_field_to_content.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AddStatusConfirmedFieldToContent < ActiveRecord::Migration - class Content < ActiveRecord::Base - include BareMigration - end - - def self.up - modify_tables_and_update \ - [:add_column, Content, :status_confirmed, :boolean] do |a| - if not $schema_generator - a.status_confirmed = (a.state =~ /ContentState::(Sp|H)am/ ? true : false) - a.save! - end - end - end - - def self.down - remove_column :contents, :status_confirmed - end -end diff --git a/db/migrate/051_fix_canonical_server_url.rb b/db/migrate/051_fix_canonical_server_url.rb deleted file mode 100644 index 418ef97ca1..0000000000 --- a/db/migrate/051_fix_canonical_server_url.rb +++ /dev/null @@ -1,17 +0,0 @@ -class FixCanonicalServerUrl < ActiveRecord::Migration - class Blog < ActiveRecord::Base - include BareMigration - serialize :settings, Hash - end - def self.up - unless $schema_generator - Blog.find(:all).each do |b| - b.settings['canonical_server_url'] = b.settings['canonical_server_url'].to_s.gsub(%r{/$},'') - b.save - end - end - end - - def self.down - end -end diff --git a/db/migrate/052_remove_cached_html.rb b/db/migrate/052_remove_cached_html.rb deleted file mode 100644 index f8a951b589..0000000000 --- a/db/migrate/052_remove_cached_html.rb +++ /dev/null @@ -1,11 +0,0 @@ -class RemoveCachedHtml < ActiveRecord::Migration - def self.up - remove_column :contents, :body_html - remove_column :contents, :extended_html - end - - def self.down - add_column :contents, :body_html, :text - add_column :contents, :extended_html, :text - end -end diff --git a/db/migrate/053_promote_canonical_server_url.rb b/db/migrate/053_promote_canonical_server_url.rb deleted file mode 100644 index 0862e89c29..0000000000 --- a/db/migrate/053_promote_canonical_server_url.rb +++ /dev/null @@ -1,22 +0,0 @@ -class PromoteCanonicalServerUrl < ActiveRecord::Migration - class Blog < ActiveRecord::Base - include BareMigration - serialize :settings, Hash - end - - def self.up - add_column :blogs, :base_url, :string - Blog.find(:all).each do |blog| - begin - blog.base_url = blog.settings['canonical_server_url'] - blog.save - rescue - # if base_url doesn't exist, then we don't really care. - end - end - end - - def self.down - remove_column :blogs, :base_url - end -end diff --git a/db/migrate/054_upgrade_sidebar_objects.rb b/db/migrate/054_upgrade_sidebar_objects.rb deleted file mode 100644 index ad4271cc24..0000000000 --- a/db/migrate/054_upgrade_sidebar_objects.rb +++ /dev/null @@ -1,26 +0,0 @@ -class UpgradeSidebarObjects < ActiveRecord::Migration - class Sidebar < ActiveRecord::Base - include BareMigration - end - - def self.up - modify_tables_and_update(:add_column, Sidebar, :type, :string) do |sb| - next if $schema_generator - if sb.controller.nil? - raise "Found a sidebar, \"#{sb.id}\", which doesn't know its controller so can't convert it. Settings are:\n #{sb.settings}. Please either correct the controller or delete the sidebar." - end - sb.type = sb.controller.camelcase + 'Sidebar' - sb.save! - end - remove_column :sidebars, :controller - end - - def self.down - modify_tables_and_update(:add_column, Sidebar, :controller, :string) do |sb| - next if $schema_generator - sb.controller = sb[:type].underscore.sub(/_sidebar$/, '') - sb.save! - end - remove_column :sidebars, :type - end -end diff --git a/db/migrate/055_link_sidebars_to_blog.rb b/db/migrate/055_link_sidebars_to_blog.rb deleted file mode 100644 index eec20f3521..0000000000 --- a/db/migrate/055_link_sidebars_to_blog.rb +++ /dev/null @@ -1,17 +0,0 @@ -class LinkSidebarsToBlog < ActiveRecord::Migration - class Sidebar < ActiveRecord::Base - include BareMigration - end - - def self.up - modify_tables_and_update(:add_column, Sidebar, :blog_id, :integer) do |sb| - next if $schema_generator - sb.blog_id = 1 - sb.save! - end - end - - def self.down - remove_column :sidebars, :blog_id - end -end diff --git a/db/migrate/056_create_notifications.rb b/db/migrate/056_create_notifications.rb deleted file mode 100644 index 2902db03da..0000000000 --- a/db/migrate/056_create_notifications.rb +++ /dev/null @@ -1,33 +0,0 @@ -class CreateNotifications < ActiveRecord::Migration - class OldNotification < ActiveRecord::Base - end - - class Notification < ActiveRecord::Base - end - - def self.up - rename_table :notifications, :old_notifications - - create_table :notifications do |t| - t.column :content_id, :integer - t.column :user_id, :integer - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - OldNotification.reset_column_information - Notification.reset_column_information - if $schema_generator - OldNotification.find(:all).each do |on| - Notification.create!(on.attributes) - end - end - drop_table :old_notifications - end - - def self.down - remove_column :notifications, :id - rename_column :notifications, :user_id, :notify_user_id - rename_column :notifications, :content_id, :notify_content_id - end -end diff --git a/db/migrate/057_add_categorization_model.rb b/db/migrate/057_add_categorization_model.rb deleted file mode 100644 index 5be705a73c..0000000000 --- a/db/migrate/057_add_categorization_model.rb +++ /dev/null @@ -1,69 +0,0 @@ -class AddCategorizationModel < ActiveRecord::Migration - class ArticlesCategory < ActiveRecord::Base - include BareMigration - end - - class Categorization < ActiveRecord::Base - include BareMigration - end - - class User < ActiveRecord::Base - end - class Content < ActiveRecord::Base - end - class Article < Content - end - class Category < ActiveRecord::Base - end - - def self.up - create_table :categorizations do |t| - t.column :article_id, :integer - t.column :category_id, :integer - t.column :is_primary, :boolean - end - - unless $schema_generator - # You need test if ArticlesCategory object exist because if - # exception raise even rescue in migration and migration failed and stop - # :( - if table_exists? :articles_categories - ArticlesCategory.all.each do |ac| - Categorization.create!(:article_id => ac.article_id, - :category_id => ac.category_id, - :is_primary => (ac.is_primary == 1)) - end - drop_table :articles_categories - end - end - # Adds the article category to the first post if and only if generating the schema - if User.count.zero? - article = Article.find(:first) - category = Category.find(:first) - say "Adding category to default article" - unless article.nil? or category.nil? - Categorization.create!(:article_id => article.id, - :category_id => category.id, - :is_primary => 1) - end - end - end - - def self.down - create_table :articles_categories, :id => false do |t| - t.column :article_id, :integer - t.column :category_id, :integer - t.column :is_primary, :integer - end - - unless $schema_generator - Categorization.find(:all).each do |c| - ArticlesCategory.create!(:article_id => c.article_id, - :category_id => c.category_id, - :is_primary => c.is_primary ? 1 : 0) - end - end - - drop_table :categorizations - end -end diff --git a/db/migrate/058_separate_entries_and_feedback.rb b/db/migrate/058_separate_entries_and_feedback.rb deleted file mode 100644 index 9789805de3..0000000000 --- a/db/migrate/058_separate_entries_and_feedback.rb +++ /dev/null @@ -1,83 +0,0 @@ -class SeparateEntriesAndFeedback < ActiveRecord::Migration - class Content < ActiveRecord::Base - set_inheritance_column :bogustype - end - - class Feedback < ActiveRecord::Base - set_table_name "feedback" - end - - def self.up - # Comment this out once you've made a backup - - create_table :feedback, :force => true do |t| - t.column "type", :string - t.column "title", :string - t.column "author", :string - t.column "body", :text - t.column "extended", :text - t.column "excerpt", :text - t.column "keywords", :string - t.column "created_at", :datetime - t.column "updated_at", :datetime - t.column "user_id", :integer - t.column "permalink", :string - t.column "guid", :string - t.column "text_filter_id", :integer - t.column "whiteboard", :text - t.column "article_id", :integer - t.column "email", :string - t.column "url", :string - t.column "ip", :string, :limit => 40 - t.column "blog_name", :string - t.column "name", :string - t.column "published", :boolean, :default => false - t.column "allow_pings", :boolean - t.column "allow_comments", :boolean - t.column "blog_id", :integer, :null => false - t.column "published_at", :datetime - t.column "state", :text - t.column "status_confirmed", :boolean - end - - # Forgot to fixup the state field earlier. Thanks to Ryan Kinderman for the spot. - Content.transaction do - Content.update_all("state = 'spam'", :state => 'ContentState::Spam') - Content.update_all("state = 'ham'", :state => 'ContentState::Ham') - Content.update_all("state = 'presumed_spam'", :state => 'ContentState::PresumedSpam') - Content.update_all("state = 'presumed_ham'", :state => 'ContentState::PresumedHam') - Content.update_all("state = 'published'", :state => 'ContentState::Published') - Content.update_all("state = 'publication_pending'", :state => 'ContentState::PublicationPending') - Content.update_all("state = 'draft'", :state => 'ContentState::Draft') - Content.update_all("state = 'withdrawn'", :state => 'ContentState::Withdrawn') - end - - Content.transaction do - Feedback.transaction do - Content.find(:all, :conditions => {:type => %w{ Comment Trackback }}).each do |content| - Feedback.new(content.attributes) do |fb| - fb[:type] = content[:type] - fb.published = (fb.state == 'ham' || fb.state == 'presumed_ham') - fb.save! - end - end - Content.delete_all(:type => %w{ Comment Trackback }) - end - end - end - - def self.down - Content.transaction do - Feedback.transaction do - Feedback.find(:all).each do |fb| - Content.new(fb.attributes) do |cnt| - cnt[:type] = fb[:type] - cnt.save! - end - end - end - end - - drop_table :feedback - end -end diff --git a/db/migrate/059_cleanup_feedback_table.rb b/db/migrate/059_cleanup_feedback_table.rb deleted file mode 100644 index 8d68d18f3f..0000000000 --- a/db/migrate/059_cleanup_feedback_table.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CleanupFeedbackTable < ActiveRecord::Migration - def self.up - remove_column :feedback, :extended - remove_column :feedback, :keywords - remove_column :feedback, :permalink - remove_column :feedback, :allow_pings - remove_column :feedback, :allow_comments - remove_column :feedback, :name - - add_index :feedback, :article_id - add_index :feedback, :text_filter_id - end - - def self.down - add_column :feedback, :extended, :text - add_column :feedback, :keywords, :string - add_column :feedback, :permalink, :string - add_column :feedback, :allow_pings, :boolean - add_column :feedback, :allow_comments, :boolean - add_column :feedback, :name, :string - - remove_index :feedback, :article_id - remove_index :feedback, :text_filter_id - end -end diff --git a/db/migrate/060_cleanup_contents_table.rb b/db/migrate/060_cleanup_contents_table.rb deleted file mode 100644 index 175109a744..0000000000 --- a/db/migrate/060_cleanup_contents_table.rb +++ /dev/null @@ -1,37 +0,0 @@ -class CleanupContentsTable < ActiveRecord::Migration - def self.up - if adapter_name == 'PostgreSQL' - indexes(:contents).each do |index| - if index.name =~ /article_id/ - remove_index(:contents, :name => index.name) - end - end - else - remove_index :contents, :article_id rescue nil - end - - remove_column :contents, :article_id rescue nil - remove_column :contents, :email - remove_column :contents, :url - remove_column :contents, :ip - remove_column :contents, :blog_name - remove_column :contents, :status_confirmed - - add_index :contents, :published - add_index :contents, :text_filter_id - end - - def self.down - remove_index :contents, :published - remove_index :contents, :text_filter_id - - add_column :contents, :article_id, :integer - add_column :contents, :email, :string - add_column :contents, :url, :string - add_column :contents, :ip, :string, :limit => 40 - add_column :contents, :blog_name, :string - add_column :contents, :status_confirmed, :boolean - - add_index :contents, :article_id - end -end diff --git a/db/migrate/061_convert_title_prefix_setting.rb b/db/migrate/061_convert_title_prefix_setting.rb deleted file mode 100644 index 1ad1e47874..0000000000 --- a/db/migrate/061_convert_title_prefix_setting.rb +++ /dev/null @@ -1,25 +0,0 @@ -class ConvertTitlePrefixSetting < ActiveRecord::Migration - class BareBlog < ActiveRecord::Base - include BareMigration - - serialize :settings, Hash - end - - def self.up - BareBlog.find(:all).each do |b| - if b.settings.has_key? "title_prefix" - b.settings["title_prefix"] = (b.settings["title_prefix"] ? 1 : 0) - b.save! - end - end - end - - def self.down - BareBlog.find(:all).each do |b| - if b.settings.has_key? "title_prefix" - b.settings["title_prefix"] = (b.settings["title_prefix"] == 1) - b.save! - end - end - end -end diff --git a/db/migrate/062_add_sitealizer_plugin.rb b/db/migrate/062_add_sitealizer_plugin.rb deleted file mode 100644 index 872230e7ee..0000000000 --- a/db/migrate/062_add_sitealizer_plugin.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddSitealizerPlugin < ActiveRecord::Migration - - def self.up - create_table :sitealizer do |t| - t.column :path, :string - t.column :ip, :string - t.column :referer, :string - t.column :language, :string - t.column :user_agent, :string - t.column :created_at, :datetime - t.column :created_on, :date - end - end - - def self.down - drop_table :sitealizer - end -end diff --git a/db/migrate/063_rejig_state_field.rb b/db/migrate/063_rejig_state_field.rb deleted file mode 100644 index 70d92d33e8..0000000000 --- a/db/migrate/063_rejig_state_field.rb +++ /dev/null @@ -1,42 +0,0 @@ -class RejigStateField < ActiveRecord::Migration - class BareContent < ActiveRecord::Base - include BareMigration - end - - class BareFeedback < ActiveRecord::Base - include BareMigration - set_table_name 'feedback' - end - - def self.up - ActiveRecord::Base.record_timestamps = false - BareContent.transaction do - BareFeedback.transaction do - [BareContent, BareFeedback].each do |klass| - klass.find(:all).each do |value| - value[:state] = value.state.to_s.demodulize.underscore - value.save! - end - end - end - end - change_column :contents, :state, :string - change_column :feedback, :state, :string - ActiveRecord::Base.record_timestamps = true - end - - def self.down - BareContent.transaction do - BareFeedback.transaction do - [BareContent, BareFeedback].each do |klass| - klass.find(:all).each do |value| - value[:state] = "ContentState::" + value.state.to_s.classify - value.save! - end - end - end - end - change_column :contents, :state, :text - change_column :feedback, :state, :string - end -end diff --git a/db/migrate/064_add_users_profile.rb b/db/migrate/064_add_users_profile.rb deleted file mode 100644 index fa517cad32..0000000000 --- a/db/migrate/064_add_users_profile.rb +++ /dev/null @@ -1,32 +0,0 @@ -class AddUsersProfile < ActiveRecord::Migration - class Profile < ActiveRecord::Base - include BareMigration - - # there's technically no need for these serialize declaration because in - # this script active_config and staged_config will always be NULL anyway. - serialize :active_config - serialize :staged_config - end - - def self.up - say "Creating users profiles" - create_table :profiles do |t| - t.column :label, :string - t.column :nicename, :string - add_column(:users, :profile_id, :integer, :default => 1) - end - - Profile.transaction do - admin = Profile.create(:label => 'admin', :nicename => 'Typo administrator') - Profile.create(:label => 'publisher', :nicename => 'Blog publisher') - Profile.create(:label => 'contributor', :nicename => 'Contributor') - end - end - - def self.down - drop_table :profiles - remove_column :users, :profile_id - end -end - - diff --git a/db/migrate/065_add_users_rights.rb b/db/migrate/065_add_users_rights.rb deleted file mode 100644 index 2e46e20ac3..0000000000 --- a/db/migrate/065_add_users_rights.rb +++ /dev/null @@ -1,119 +0,0 @@ -class AddUsersRights < ActiveRecord::Migration - class Right < ActiveRecord::Base - include BareMigration - - # there's technically no need for these serialize declaration because in - # this script active_config and staged_config will always be NULL anyway. - serialize :active_config - serialize :staged_config - end - - class ProfilesToRight < ActiveRecord::Base - include BareMigration - - # there's technically no need for these serialize declaration because in - # this script active_config and staged_config will always be NULL anyway. - serialize :active_config - serialize :staged_config - end - - class Profile < ActiveRecord::Base - end - - def self.up - say "Creating users rights" - create_table :rights, :force => true do |t| - t.column :name, :string - t.column :description, :string - end - - create_table :profiles_to_rights, :force => true do |t| - t.column :profile_id, :int - t.column :right_id, :int - end - - Right.transaction do - admin = Profile.find_by_label('admin') - publisher = Profile.find_by_label('publisher') - contributor = Profile.find_by_label('contributor') - - # Global admin rights - right = Right.create(:name => 'admin', :description => 'Global administration') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - - # Article rights - right = Right.create(:name => 'content_create', :description => 'Create article') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - right = Right.create(:name => 'content_edit', :description => 'Edit article') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - right = Right.create(:name => 'content_delete', :description => 'Delete article') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - - # Categories rights - right = Right.create(:name => 'category_create', :description => 'Create a category') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - right = Right.create(:name => 'category_edit', :description => 'Edit a category') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - right = Right.create(:name => 'category_delete', :description => 'Delete a category') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - - # Page rights - right = Right.create(:name => 'page_create', :description => 'Create a category') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - right = Right.create(:name => 'page_edit', :description => 'Edit a category') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - right = Right.create(:name => 'page_delete', :description => 'Delete a category') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - - # Feedback - right = Right.create(:name => 'feedback_create', :description => 'Add a comment') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => contributor.id, :right_id => right.id) - right = Right.create(:name => 'feedback_self_edit', :description => 'Edit self comments') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => contributor.id, :right_id => right.id) - right = Right.create(:name => 'feedback_edit', :description => 'Edit any comment') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => contributor.id, :right_id => right.id) - right = Right.create(:name => 'feedback_self_delete', :description => 'Delete self comments') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => contributor.id, :right_id => right.id) - right = Right.create(:name => 'feedback_delete', :description => 'Delete any comment') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => contributor.id, :right_id => right.id) - - # Users - right = Right.create(:name => 'user_create', :description => 'Create users') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - right = Right.create(:name => 'user_edit', :description => 'Edit users') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - right = Right.create(:name => 'user_self_edit', :description => 'Edit self account') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => publisher.id, :right_id => right.id) - ProfilesToRight.create(:profile_id => contributor.id, :right_id => right.id) - right = Right.create(:name => 'user_delete', :description => 'Delete users') - ProfilesToRight.create(:profile_id => admin.id, :right_id => right.id) - end - end - - def self.down - drop_table :rights - drop_table :profiles_to_rights - end -end - - diff --git a/db/migrate/066_fix_profiles.rb b/db/migrate/066_fix_profiles.rb deleted file mode 100644 index 046ab77dc7..0000000000 --- a/db/migrate/066_fix_profiles.rb +++ /dev/null @@ -1,23 +0,0 @@ -class FixProfiles < ActiveRecord::Migration - # We got this migration wrong before. Easiest fix is to undo it, then reapply - # correctly - - class User < ActiveRecord::Base - include BareMigration - end - - class Profile < ActiveRecord::Base - end - - def self.up - remove_column :users, :profile_id - add_column :users, :profile_id, :integer - admin_id = Profile.find_by_label('admin').id - User.update_all("profile_id = #{admin_id}") - end - - def self.down - remove_column :users, :profile_id - add_column :users, :profile_id, :integer, :default => 1 - end -end diff --git a/db/migrate/067_remove_blog_ids.rb b/db/migrate/067_remove_blog_ids.rb deleted file mode 100644 index e7e5293cd5..0000000000 --- a/db/migrate/067_remove_blog_ids.rb +++ /dev/null @@ -1,43 +0,0 @@ -class RemoveBlogIds < ActiveRecord::Migration - class Content < ActiveRecord::Base - set_inheritance_column :bogustype - end - - class Feedback < ActiveRecord::Base - set_table_name "feedback" - end - - class Sidebar < ActiveRecord::Base - end - - def self.up - if adapter_name == 'PostgreSQL' - indexes(:contents).each do |index| - if index.name =~ /blog_id/ - remove_index(:contents, :name => index.name) - end - end - else - remove_index :contents, :blog_id rescue nil - end - remove_column :contents, :blog_id - remove_column :sidebars, :blog_id - remove_column :feedback, :blog_id - end - - def self.down - add_column :contents, :blog_id, :integer - add_column :sidebars, :blog_id, :integer - add_column :feedback, :blog_id, :integer - - default_blog_id = Blog.find(:first, :order => 'id').id - - Content.update_all("blog_id = #{default_blog_id}") - Feedback.update_all("blog_id = #{default_blog_id}") - Sidebar.update_all("blog_id = #{default_blog_id}") - - change_column :sidebars, :blog_id, :integer, :null => false - - add_index :contents, :blog_id - end -end diff --git a/db/migrate/068_fix_grants.rb b/db/migrate/068_fix_grants.rb deleted file mode 100644 index 2976e03e15..0000000000 --- a/db/migrate/068_fix_grants.rb +++ /dev/null @@ -1,13 +0,0 @@ -class FixGrants < ActiveRecord::Migration - def self.up - say_with_time "Renaming ProfilesToRight to ProfilesRight" do - rename_table :profiles_to_rights, :profiles_rights - end - end - - def self.down - rename_table :profiles_rights, :profiles_to_rights - end -end - - diff --git a/db/migrate/069_add_modules_to_profile.rb b/db/migrate/069_add_modules_to_profile.rb deleted file mode 100644 index 9b9a289915..0000000000 --- a/db/migrate/069_add_modules_to_profile.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddModulesToProfile < ActiveRecord::Migration - class Profile < ActiveRecord::Base - include BareMigration - - serialize :profiles - end - - def self.up - add_column :profiles, :modules, :text - - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :themes, :sidebar, :users, :settings]) - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :write, :content, :feedback ]) - end - - def self.down - remove_column :profiles, :modules - end -end diff --git a/db/migrate/070_add_users_to_non_admins.rb b/db/migrate/070_add_users_to_non_admins.rb deleted file mode 100644 index 2ed0d65dd9..0000000000 --- a/db/migrate/070_add_users_to_non_admins.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddUsersToNonAdmins < ActiveRecord::Migration - class Profile < ActiveRecord::Base - include BareMigration - - serialize :profiles - end - - def self.up - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :users ]) - Profile.find_by_label("contributor").update_attributes(:modules => [:dashboard, :users ]) - end - - def self.down - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :write, :content, :feedback ]) - Profile.find_by_label("contributor").update_attributes(:modules => []) - end -end diff --git a/db/migrate/071_fix_tags_naming.rb b/db/migrate/071_fix_tags_naming.rb deleted file mode 100644 index 7d754f88d7..0000000000 --- a/db/migrate/071_fix_tags_naming.rb +++ /dev/null @@ -1,21 +0,0 @@ -class FixTagsNaming < ActiveRecord::Migration - class Tag < ActiveRecord::Base - end - - def self.up - tags = Tag.find(:all) - tags.each do |tag| - tag.name = tag.name.gsub('.', '-') - tag.save! - end - end - - def self.down - tags = Tag.find(:all) - tags.each do |tag| - tag.name = tag.display_name.gsub('-', '.') - tag.name = tag.name.gsub(' ', '').downcase - tag.save! - end - end -end diff --git a/db/migrate/072_add_remember_token.rb b/db/migrate/072_add_remember_token.rb deleted file mode 100644 index ff6c874ea0..0000000000 --- a/db/migrate/072_add_remember_token.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddRememberToken < ActiveRecord::Migration - def self.up - add_column :users, :remember_token, :string - end - - def self.down - remove_column :users, :remember_token - end -end \ No newline at end of file diff --git a/db/migrate/073_add_meta_and_subcategories.rb b/db/migrate/073_add_meta_and_subcategories.rb deleted file mode 100644 index f7d0463dd6..0000000000 --- a/db/migrate/073_add_meta_and_subcategories.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddMetaAndSubcategories < ActiveRecord::Migration - def self.up - add_column :categories, :keywords, :text - add_column :categories, :description, :text - add_column :categories, :parent_id, :integer - end - - def self.down - remove_column :categories, :keywords - remove_column :categories, :description - remove_column :categories, :parent_id - end -end diff --git a/db/migrate/074_add_remember_token_expires_at.rb b/db/migrate/074_add_remember_token_expires_at.rb deleted file mode 100644 index 10df497465..0000000000 --- a/db/migrate/074_add_remember_token_expires_at.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddRememberTokenExpiresAt < ActiveRecord::Migration - def self.up - add_column :users, :remember_token_expires_at, :datetime - end - - def self.down - remove_column :users, :remember_token_expires_at - end -end \ No newline at end of file diff --git a/db/migrate/075_move_editor_to_user.rb b/db/migrate/075_move_editor_to_user.rb deleted file mode 100644 index 453c493a63..0000000000 --- a/db/migrate/075_move_editor_to_user.rb +++ /dev/null @@ -1,13 +0,0 @@ -class MoveEditorToUser < ActiveRecord::Migration - class User < ActiveRecord::Base - end - - def self.up - add_column :users, :editor, :integer, :default => 2 - User.update_all("editor = #{Blog.default.editor.to_i}") - end - - def self.down - remove_column :users, :editor - end -end diff --git a/db/migrate/076_fix_users_empty_email.rb b/db/migrate/076_fix_users_empty_email.rb deleted file mode 100644 index ddce017262..0000000000 --- a/db/migrate/076_fix_users_empty_email.rb +++ /dev/null @@ -1,18 +0,0 @@ -class FixUsersEmptyEmail < ActiveRecord::Migration - class User < ActiveRecord::Base - end - - def self.up - users = User.find(:all) - users.each do |user| - if user.email.empty? - user.email = "typo@typo" - user.save! - end - end - end - - def self.down - - end -end diff --git a/db/migrate/077_fix_userless_articles.rb b/db/migrate/077_fix_userless_articles.rb deleted file mode 100644 index 91cd8a9537..0000000000 --- a/db/migrate/077_fix_userless_articles.rb +++ /dev/null @@ -1,27 +0,0 @@ -class FixUserlessArticles < ActiveRecord::Migration - class User < ActiveRecord::Base - end - class Content < ActiveRecord::Base - end - class Article < Content - end - - def self.up - unless $schema_generator - articles = Article.find(:all) - say "Fixing articles with empty user_id" - - articles.each do |article| - if article.user.nil? - say "Fixing article #{article.id} having empty user", true - article.user_id = 1 - article.save! - end - end - end - end - - def self.down - - end -end diff --git a/db/migrate/078_add_textfilter_to_users.rb b/db/migrate/078_add_textfilter_to_users.rb deleted file mode 100644 index 535356c19a..0000000000 --- a/db/migrate/078_add_textfilter_to_users.rb +++ /dev/null @@ -1,20 +0,0 @@ -class AddTextfilterToUsers < ActiveRecord::Migration - class TextFilter < ActiveRecord::Base - end - class User < ActiveRecord::Base - end - - def self.up - f = TextFilter.find(:first, :conditions => ["name = ?", "none"]) - add_column :users, :text_filter_id, :string, :default => f.id - - unless Blog.default.nil? - t = TextFilter.find(:first, :conditions => "name= '#{Blog.default.text_filter}'") - User.update_all("text_filter_id = #{t.id}") - end - end - - def self.down - remove_column :users, :text_filter_id, :integer - end -end diff --git a/db/migrate/079_move_editor_as_string.rb b/db/migrate/079_move_editor_as_string.rb deleted file mode 100644 index 9623b59a0f..0000000000 --- a/db/migrate/079_move_editor_as_string.rb +++ /dev/null @@ -1,19 +0,0 @@ -class MoveEditorAsString < ActiveRecord::Migration - class User < ActiveRecord::Base - end - - def self.up - remove_column :users, :editor - add_column :users, :editor, :string, :default => 'simple' - - unless $schema_generator - User.update_all("editor = 'simple'") - end - - end - - def self.down - remove_column :users, :editor - add_column :users, :editor, :integer, :default => 0 - end -end diff --git a/db/migrate/080_add_state_to_user.rb b/db/migrate/080_add_state_to_user.rb deleted file mode 100644 index 73cc05462e..0000000000 --- a/db/migrate/080_add_state_to_user.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddStateToUser < ActiveRecord::Migration - class User < ActiveRecord::Base - end - - def self.up - add_column :users, :state, :string, :default => 'active' - - unless $schema_generator - User.update_all("state = 'active'") - end - - end - - def self.down - remove_column :users, :state - end -end diff --git a/db/migrate/081_create_cache_informations.rb b/db/migrate/081_create_cache_informations.rb deleted file mode 100644 index 52eb36965b..0000000000 --- a/db/migrate/081_create_cache_informations.rb +++ /dev/null @@ -1,66 +0,0 @@ -class CreateCacheInformations < ActiveRecord::Migration - class PageCache < ActiveRecord::Base - - def self.public_path - ActionController::Base.page_cache_directory - end - - def self.zap_pages(paths) - # Ensure no one is going to wipe his own blog public directory - # It happened once on a release and was no fun at all - return if public_path == "#{::Rails.root.to_s}/public" - srcs = paths.map { |v| - Dir.glob(public_path + "/#{v}") - }.flatten - return true if srcs.empty? - trash = ::Rails.root.to_s + "/tmp/typodel.#{UUIDTools::UUID.random_create}" - FileUtils.makedirs(trash) - FileUtils.mv(srcs, trash, :force => true) - FileUtils.rm_rf(trash) - end - - def self.old_sweep_all - logger.debug "PageCache - sweep_all called by #{caller[1].inspect}" - unless Blog.default.nil? - self.zap_pages(%w{index.* articles.* pages page - pages.* feedback feedback.* - comments comments.* - category categories.* xml - sitemap.xml - *.rss *.atom - tag tags.* category archives.*}) - - self.zap_pages((1990..2020)) - self.zap_pages([*1990..2020].collect { |y| "#{y}.*" }) - end - end - - end - - def self.up - - # With this migration, Old cache is useless. So we need delete all old cache - # Now what page is in cache is manage by cache_informations table - PageCache.old_sweep_all - - # In commit before, cache manage by file. We delete this cache if exist. - # It's use only to all edge blog updated several time - if File.exist?(File.join(Rails.root,'path_cache')) - File.read(File.join(Rails.root,'path_cache')).split("\n").each do |page_save| - FileUtils.rm File.join(PageCache.public_path, page_save) - end - FileUtils.rm_f File.join(Rails.root,'path_cache') - end - - create_table :cache_informations do |t| - t.string :path - t.timestamps - end - # Add index on path because there are validates_uniqueness on it - add_index :cache_informations, :path - end - - def self.down - drop_table :cache_informations - end -end diff --git a/db/migrate/082_add_users_options.rb b/db/migrate/082_add_users_options.rb deleted file mode 100644 index eade96b28f..0000000000 --- a/db/migrate/082_add_users_options.rb +++ /dev/null @@ -1,39 +0,0 @@ -class AddUsersOptions < ActiveRecord::Migration - class User < ActiveRecord::Base - end - - def self.up - add_column :users, :firstname, :string - add_column :users, :lastname, :string - add_column :users, :nickname, :string - add_column :users, :url, :string - add_column :users, :msn, :string - add_column :users, :aim, :string - add_column :users, :yahoo, :string - add_column :users, :twitter, :string - add_column :users, :description, :text - remove_column :users, :notify_via_jabber - - unless $schema_generator - users = User.find(:all) - users.each do |user| - user.nickname = user.name - user.save! - end - end - end - - def self.down - remove_column :users, :firstname - remove_column :users, :lastname - remove_column :users, :nickname - remove_column :users, :url - remove_column :users, :msn - remove_column :users, :aim - remove_column :users, :jabber - remove_column :users, :twitter - remove_column :users, :yahoo - remove_column :users, :description - add_column :users, :notify_via_jabber, :tinyint - end -end diff --git a/db/migrate/083_add_users_display_perms.rb b/db/migrate/083_add_users_display_perms.rb deleted file mode 100644 index ec73ac6b3b..0000000000 --- a/db/migrate/083_add_users_display_perms.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AddUsersDisplayPerms < ActiveRecord::Migration - def self.up - add_column :users, :show_url, :boolean - add_column :users, :show_msn, :boolean - add_column :users, :show_aim, :boolean - add_column :users, :show_yahoo, :boolean - add_column :users, :show_twitter, :boolean - add_column :users, :show_jabber, :boolean - end - - def self.down - remove_column :users, :show_url - remove_column :users, :show_msn - remove_column :users, :show_aim - remove_column :users, :show_yahoo - remove_column :users, :show_twitter - remove_column :users, :show_jabber - end -end diff --git a/db/migrate/084_move_users_to_profiles.rb b/db/migrate/084_move_users_to_profiles.rb deleted file mode 100644 index 0d9a69ce1f..0000000000 --- a/db/migrate/084_move_users_to_profiles.rb +++ /dev/null @@ -1,19 +0,0 @@ -class MoveUsersToProfiles < ActiveRecord::Migration - class Profile < ActiveRecord::Base - include BareMigration - - serialize :profiles - end - - def self.up - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :profile ]) - Profile.find_by_label("contributor").update_attributes(:modules => [:dashboard, :profile ]) - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :themes, :sidebar, :users, :settings, :profile]) - end - - def self.down - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :users ]) - Profile.find_by_label("contributor").update_attributes(:modules => [:dashboard, :users ]) - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :themes, :sidebar, :users, :settings ]) - end -end diff --git a/db/migrate/085_add_article_parent_draft.rb b/db/migrate/085_add_article_parent_draft.rb deleted file mode 100644 index 0b10409ff2..0000000000 --- a/db/migrate/085_add_article_parent_draft.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddArticleParentDraft < ActiveRecord::Migration - def self.up - add_column :contents, :parent_id, :integer - end - - def self.down - remove_column :contents, :parent_id - end -end diff --git a/db/migrate/086_add_user_last_connection.rb b/db/migrate/086_add_user_last_connection.rb deleted file mode 100644 index dc988d48f1..0000000000 --- a/db/migrate/086_add_user_last_connection.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddUserLastConnection < ActiveRecord::Migration - def self.up - add_column :users, :last_connection, :datetime - end - - def self.down - remove_column :users, :last_connection - end -end diff --git a/db/migrate/087_drop_blacklist_patterns.rb b/db/migrate/087_drop_blacklist_patterns.rb deleted file mode 100644 index 4e683c3da5..0000000000 --- a/db/migrate/087_drop_blacklist_patterns.rb +++ /dev/null @@ -1,14 +0,0 @@ -class DropBlacklistPatterns < ActiveRecord::Migration - def self.up - drop_table :blacklist_patterns - end - - def self.down - create_table :blacklist_patterns do |t| - t.column :type, :string - t.column :pattern, :string - end - - add_index :blacklist_patterns, :pattern - end -end diff --git a/db/migrate/088_drop_session_table.rb b/db/migrate/088_drop_session_table.rb deleted file mode 100644 index dccd970fde..0000000000 --- a/db/migrate/088_drop_session_table.rb +++ /dev/null @@ -1,16 +0,0 @@ -class DropSessionTable < ActiveRecord::Migration - def self.up - drop_table :sessions - end - - def self.down - create_table :sessions do |t| - t.column :sessid, :string - t.column :data, :text - t.column :created_at, :datetime - t.column :updated_at, :datetime - end - - add_index :sessions, :sessid - end -end diff --git a/db/migrate/089_drop_cache_information_table.rb b/db/migrate/089_drop_cache_information_table.rb deleted file mode 100644 index e6b3ac3a24..0000000000 --- a/db/migrate/089_drop_cache_information_table.rb +++ /dev/null @@ -1,31 +0,0 @@ -# Dummy class to declare the model before droping -class CacheInformation < ActiveRecord::Base - -end - -class DropCacheInformationTable < ActiveRecord::Migration - def self.up - # On 99.9% existing blogs, cache will be installed in public/ - # That means we first need to wipe existing files or they will be served - # And the cache will never be accessed - list = CacheInformation.find(:all) - - list.each do |file| - path = File.join(::Rails.root.to_s, 'public', file.path) - if File.exist?(path) - FileUtils.rm(path) - end - end - - drop_table :cache_informations - end - - def self.down - create_table :cache_informations do |t| - t.string :path - t.timestamps - end - # Add index on path because there are validates_uniqueness on it - add_index :cache_informations, :path - end -end diff --git a/db/migrate/090_remove_keywords_from_posts.rb b/db/migrate/090_remove_keywords_from_posts.rb deleted file mode 100644 index 15d0f4a75a..0000000000 --- a/db/migrate/090_remove_keywords_from_posts.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveKeywordsFromPosts < ActiveRecord::Migration - def self.up - remove_column :contents, :keywords - end - - def self.down - add_column :contents, :keywords, :string - end -end diff --git a/db/migrate/091_adds_password_protection_to_posts.rb b/db/migrate/091_adds_password_protection_to_posts.rb deleted file mode 100644 index e48feccd15..0000000000 --- a/db/migrate/091_adds_password_protection_to_posts.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddsPasswordProtectionToPosts < ActiveRecord::Migration - def self.up - add_column :contents, :password, :string - end - - def self.down - remove_column :contents, :password - end -end diff --git a/db/migrate/092_drops_profile_rights_primary_key.rb b/db/migrate/092_drops_profile_rights_primary_key.rb deleted file mode 100644 index ff3360fcbf..0000000000 --- a/db/migrate/092_drops_profile_rights_primary_key.rb +++ /dev/null @@ -1,9 +0,0 @@ -class DropsProfileRightsPrimaryKey < ActiveRecord::Migration - def self.up - remove_column :profiles_rights, :id - end - - def self.down - add_column :profiles_rights, :id, :integer - end -end diff --git a/db/migrate/093_add_redirections_model.rb b/db/migrate/093_add_redirections_model.rb deleted file mode 100644 index d55af61fa3..0000000000 --- a/db/migrate/093_add_redirections_model.rb +++ /dev/null @@ -1,58 +0,0 @@ -class AddRedirectionsModel < ActiveRecord::Migration - class Redirect < ActiveRecord::Base - has_many :redirections - has_many :contents, :through => :redirections - end - - class Redirection < ActiveRecord::Base - belongs_to :content - belongs_to :redirect - end - - class Content < ActiveRecord::Base - has_many :redirections - has_many :redirects, :through => :redirections - scope :already_published, { - :conditions => ['published = ? AND published_at < ?', true, Time.now] } - - # Avoid STI errors - set_inheritance_column :bogustype - end - - def self.up - create_table :redirections do |t| - t.column :content_id, :integer - t.column :redirect_id, :integer - end - - say_with_time "Creating shortened URL for existing contents, this may take a moment" do - Content.already_published.each do |art| - - # Begin / rescue statement is mandatory here because I have something - # fishy in my database coming from a very old Wordpress import - # This can happen you too - begin - say "Processing #{art.type} #{art.id}", true - red = Redirect.new - red.from_path = red.shorten - red.to_path = art.permalink_url - art.redirects << red - art.save - rescue - nil - end - end - end - end - - def self.down - Content.already_published.each do |art| - art.redirects.each do |red| - red.destroy - end - end - - drop_table :redirections - end -end - diff --git a/db/migrate/094_fix_extended_on_rss_behavior.rb b/db/migrate/094_fix_extended_on_rss_behavior.rb deleted file mode 100644 index 10db5e02ef..0000000000 --- a/db/migrate/094_fix_extended_on_rss_behavior.rb +++ /dev/null @@ -1,14 +0,0 @@ -class FixExtendedOnRssBehavior < ActiveRecord::Migration - def self.up - unless Blog.default.nil? - Blog.default.hide_extended_on_rss = true unless Blog.default.show_extended_on_rss - Blog.default.save! - end - end - - def self.down - blog = Blog.first - Blog.default.show_extended_on_rss = true unless Blog.default.hide_extended_on_rss - Blog.default.save! - end -end diff --git a/db/migrate/095_adds_seo_to_profiles.rb b/db/migrate/095_adds_seo_to_profiles.rb deleted file mode 100644 index 54bf2cb264..0000000000 --- a/db/migrate/095_adds_seo_to_profiles.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddsSeoToProfiles < ActiveRecord::Migration - class Profile < ActiveRecord::Base - include BareMigration - - serialize :profiles - end - - def self.up - say "Adding the seo module to admin profile" - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :themes, :sidebar, :users, :settings, :profile, :seo]) - end - - def self.down - say "Removing the seo module to admin profile" - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :themes, :sidebar, :users, :settings, :profile ]) - end -end diff --git a/db/migrate/096_add_origin_to_redirects.rb b/db/migrate/096_add_origin_to_redirects.rb deleted file mode 100644 index 385914470c..0000000000 --- a/db/migrate/096_add_origin_to_redirects.rb +++ /dev/null @@ -1,47 +0,0 @@ -class AddOriginToRedirects < ActiveRecord::Migration - class Redirect < ActiveRecord::Base - has_many :redirections - has_many :contents, :through => :redirections - end - - class Redirection < ActiveRecord::Base - belongs_to :content - belongs_to :redirect - end - - class Content < ActiveRecord::Base - has_many :redirections - has_many :redirects, :through => :redirections - scope :already_published, { - :conditions => ['published = ? AND published_at < ?', true, Time.now] } - - # Avoid STI errors - set_inheritance_column :bogustype - end - - def self.up - add_column :redirects, :origin, :string - - say "Adding origin to redirects made by URL shortener" - Content.already_published.each do |art| - - # Begin / rescue statement is mandatory here because I have something - # fishy in my database coming from a very old Wordpress import - # This can happen you too - begin - say "Processing #{art.type} #{art.id}", true - art.redirects.each do |r| - r.origin = "shortener" - r.save! - end - rescue - nil - end - end - end - - def self.down - remove_column :redirects, :origin - end -end - diff --git a/db/migrate/097_fix_nofollow_options_behavior.rb b/db/migrate/097_fix_nofollow_options_behavior.rb deleted file mode 100644 index 93467995c0..0000000000 --- a/db/migrate/097_fix_nofollow_options_behavior.rb +++ /dev/null @@ -1,18 +0,0 @@ -class FixNofollowOptionsBehavior < ActiveRecord::Migration - def self.up - unless Blog.default.nil? - Blog.default.unindex_categories = false if Blog.default.index_categories - Blog.default.unindex_tags = false if Blog.default.index_tags - Blog.default.dofollowify = true unless Blog.default.nofollowify - Blog.default.save! - end - end - - def self.down - blog = Blog.first - Blog.default.index_categories = true unless Blog.default.unindex_categories - Blog.default.index_tags = true unless Blog.default.unindex_tags - Blog.default.dofollowify = true unless Blog.default.nofollowify - Blog.default.save! - end -end diff --git a/db/migrate/098_add_users_settings.rb b/db/migrate/098_add_users_settings.rb deleted file mode 100644 index be2fbb028c..0000000000 --- a/db/migrate/098_add_users_settings.rb +++ /dev/null @@ -1,228 +0,0 @@ -class AddUsersSettings < ActiveRecord::Migration - class BareSetting < ActiveRecord::Base - include BareMigration - belongs_to :user, :class_name => "AddUsersSettings::BareUser" - end - - class BareUser < ActiveRecord::Base - include BareMigration - serialize :settings - - class SettingSpec - attr_accessor :key, :type, :default - - def initialize(key, type, default) - self.key = key - self.type = type - self.default = default - end - - def normalize_value(line) - if !line || line.value.nil? - return default - end - value = line.value - case type - when :boolean - ! value.match(/^(?:f(?:alse)?|0|)$/) - when :integer - value.to_i - when :string - value - else - YAML::load(value) - end - end - - def stringify_value(value) - case type - when :boolean - value.to_s - when :integer - value.to_s - when :string - value - else - value.to_yaml - end - end - end - - def self.fields(key = nil) - @@fields ||= { } - key ? @@fields[key.to_sym] : @@fields - end - - def self.setting(key, type, default) - fields[key.to_sym] = SettingSpec.new(key.to_sym, type, default) - end - - setting :notify_watch_my_articles, :boolean, true - setting :editor, :string, 'visual' - setting :firstname, :string, '' - setting :lastname, :string, '' - setting :nickname, :string, '' - setting :description, :string, '' - setting :url, :string, '' - setting :msn, :string, '' - setting :aim, :string, '' - setting :yahoo, :string, '' - setting :twitter, :string, '' - setting :jabber, :string, '' - setting :show_url, :boolean, false - setting :show_msn, :boolean, false - setting :show_aim, :boolean, false - setting :show_yahoo, :boolean, false - setting :show_twitter, :boolean, false - setting :show_jabber, :boolean, false - - end - - def self.up - # There must be a better way to do it but... - # 1. I didn't find it. - # 2. I'm lost in the countryside where I need to go to the back of the - # garden to have a phone connection and in the middle of a field to have - # a chance to get my emails. - # - # Problem: settings names overlap fields names. - # Solution: rename columns, migrate, remove columns. - # - # At least it works - # - # Some fields were not migrated because we do some User.find on them : - # – notify_via_email - # – notify_on_new_articles - # – notify_on_comments - # - - rename_column :users, :notify_watch_my_articles, :s_notify_watch_my_articles - rename_column :users, :editor, :s_editor - rename_column :users, :firstname, :s_firstname - rename_column :users, :lastname, :s_lastname - rename_column :users, :nickname, :s_nickname - rename_column :users, :description, :s_description - rename_column :users, :url, :s_url - rename_column :users, :msn, :s_msn - rename_column :users, :aim, :s_aim - rename_column :users, :yahoo, :s_yahoo - rename_column :users, :twitter, :s_twitter - rename_column :users, :jabber, :s_jabber - rename_column :users, :show_url, :s_show_url - rename_column :users, :show_msn, :s_show_msn - rename_column :users, :show_aim, :s_show_aim - rename_column :users, :show_yahoo, :s_show_yahoo - rename_column :users, :show_twitter, :s_show_twitter - rename_column :users, :show_jabber, :s_show_jabber - add_column :users, :settings, :text - - unless $schema_generator - begin - BareSetting.transaction do - BareUser.find(:all).each do |user| - user.settings = { } -# user.settings['notify_via_email'] = user.s_notify_via_email -# user.settings['notify_on_new_articles'] = user.s_notify_on_new_articles -# user.settings['notify_on_comments'] = user.s_notify_on_comments - user.settings['notify_watch_my_articles'] = user.s_notify_watch_my_articles -# user.settings['text_filter_id'] = user.s_text_filter_id - user.settings['editor'] = user.s_editor - user.settings['firstname'] = user.s_firstname - user.settings['lastname'] = user.s_lastname - user.settings['nickname'] = user.s_nickname - user.settings['description'] = user.s_description - user.settings['url'] = user.s_url - user.settings['msn'] = user.s_msn - user.settings['aim'] = user.s_aim - user.settings['yahoo'] = user.s_yahoo - user.settings['twitter'] = user.s_twitter - user.settings['jabber'] = user.s_jabber - user.settings['show_url'] = user.s_show_url - user.settings['show_msn'] = user.s_show_msn - user.settings['show_aim'] = user.s_show_aim - user.settings['show_yahoo'] = user.s_show_yahoo - user.settings['show_twitter'] = user.s_show_twitter - user.settings['show_jabber'] = user.s_show_jabber - user.save - end - end - rescue Exception => e - rename_column :users, :s_notify_watch_my_articles, :notify_watch_my_articles - rename_column :users, :s_editor, :editor - rename_column :users, :s_firstname, :firstname - rename_column :users, :s_lastname, :lastname - rename_column :users, :s_nickname, :nickname - rename_column :users, :s_description, :description - rename_column :users, :s_url, :url - rename_column :users, :s_msn, :msn - rename_column :users, :s_aim, :aim - rename_column :users, :s_yahoo, :yahoo - rename_column :users, :s_twitter, :twitter - rename_column :users, :s_jabber, :jabber - rename_column :users, :s_show_url, :show_url - rename_column :users, :s_show_msn, :show_msn - rename_column :users, :s_show_aim, :show_aim - rename_column :users, :s_show_yahoo, :show_yahoo - rename_column :users, :s_show_twitter, :show_twitter - rename_column :users, :s_show_jabber, :show_jabber - remove_column :users, :settings rescue nil - raise e - end - end - - remove_column :users, :s_notify_watch_my_articles - remove_column :users, :s_editor - remove_column :users, :s_firstname - remove_column :users, :s_lastname - remove_column :users, :s_nickname - remove_column :users, :s_description - remove_column :users, :s_url - remove_column :users, :s_msn - remove_column :users, :s_aim - remove_column :users, :s_yahoo - remove_column :users, :s_twitter - remove_column :users, :s_jabber - remove_column :users, :s_show_url - remove_column :users, :s_show_msn - remove_column :users, :s_show_aim - remove_column :users, :s_show_yahoo - remove_column :users, :s_show_twitter - remove_column :users, :s_show_jabber - - end - - def self.down - # FIXME: The code below does not reverse this migration! - raise ActiveRecord::IrreversibleMigration - begin - create_settings - unless $schema_generator - BareSetting.transaction do - BareBlog.find(:all).each do |blog| - blog.settings ||= { } - BareSetting.with_scope(:create => { :blog_id => blog.id }) do - BareBlog.fields.each do |key, spec| - next unless blog.settings.has_key?(key.to_s) - BareSetting.create!(:name => key.to_s, - :value => spec.stringify_value(blog.settings[key.to_s])) - end - end - end - end - end - remove_column :blogs, :settings rescue nil - rescue Exception => e - drop_table :settings rescue nil - raise e - end - end - - def self.create_settings - create_table :settings do |t| - t.column :name, :string, :limit => 255 - t.column :value, :string, :limit => 255 - t.column :position, :integer - t.column :blog_id, :integer - end - end -end diff --git a/db/migrate/099_splits_content_rules_articles_pages.rb b/db/migrate/099_splits_content_rules_articles_pages.rb deleted file mode 100644 index fdd8005847..0000000000 --- a/db/migrate/099_splits_content_rules_articles_pages.rb +++ /dev/null @@ -1,19 +0,0 @@ -class SplitsContentRulesArticlesPages < ActiveRecord::Migration - class Profile < ActiveRecord::Base - include BareMigration - - serialize :profiles - end - - def self.up - say "Splits content modules into pages and articles" - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :articles, :pages, :media, :feedback, :themes, :sidebar, :users, :settings, :profile, :seo]) - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :articles, :media, :pages, :feedback, :profile]) - end - - def self.down - say "Merges pages and articles to content" - Profile.find_by_label("admin").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :themes, :sidebar, :users, :settings, :profile, :seo ]) - Profile.find_by_label("publisher").update_attributes(:modules => [:dashboard, :write, :content, :feedback, :profile ]) - end -end diff --git a/db/migrate/100_adds_content_settings.rb b/db/migrate/100_adds_content_settings.rb deleted file mode 100644 index 8e6a099b42..0000000000 --- a/db/migrate/100_adds_content_settings.rb +++ /dev/null @@ -1,132 +0,0 @@ -class AddsContentSettings < ActiveRecord::Migration - class BareSetting < ActiveRecord::Base - include BareMigration - belongs_to :user, :class_name => "AddsContentSettings::BareContent" - end - - class BareContent < ActiveRecord::Base - include BareMigration - serialize :settings - - class SettingSpec - attr_accessor :key, :type, :default - - def initialize(key, type, default) - self.key = key - self.type = type - self.default = default - end - - def normalize_value(line) - if !line || line.value.nil? - return default - end - value = line.value - case type - when :boolean - ! value.match(/^(?:f(?:alse)?|0|)$/) - when :integer - value.to_i - when :string - value - else - YAML::load(value) - end - end - - def stringify_value(value) - case type - when :boolean - value.to_s - when :integer - value.to_s - when :string - value - else - value.to_yaml - end - end - end - - def self.fields(key = nil) - @@fields ||= { } - key ? @@fields[key.to_sym] : @@fields - end - - def self.setting(key, type, default) - fields[key.to_sym] = SettingSpec.new(key.to_sym, type, default) - end - - setting :password, :string, '' - end - - def self.up - # There must be a better way to do it but... - # 1. I didn't find it. - # 2. I'm lost in the countryside where I need to go to the back of the - # garden to have a phone connection and in the middle of a field to have - # a chance to get my emails. - # - # Problem: settings names overlap fields names. - # Solution: rename columns, migrate, remove columns. - # - # At least it works - # - - rename_column :contents, :password, :s_password - add_column :contents, :settings, :text - - unless $schema_generator - begin - BareSetting.transaction do - BareContent.find(:all).each do |content| - content.settings = { } - content.settings['password'] = content.s_password - content.save - end - end - rescue Exception => e - rename_column :contents, :s_password, :password - remove_column :contents, :settings rescue nil - raise e - end - end - - remove_column :contents, :s_password - end - - def self.down - # FIXME: The code below does not reverse this migration! - raise ActiveRecord::IrreversibleMigration - begin - create_settings - unless $schema_generator - BareSetting.transaction do - BareBlog.find(:all).each do |blog| - blog.settings ||= { } - BareSetting.with_scope(:create => { :blog_id => blog.id }) do - BareBlog.fields.each do |key, spec| - next unless blog.settings.has_key?(key.to_s) - BareSetting.create!(:name => key.to_s, - :value => spec.stringify_value(blog.settings[key.to_s])) - end - end - end - end - end - remove_column :blogs, :settings rescue nil - rescue Exception => e - drop_table :settings rescue nil - raise e - end - end - - def self.create_settings - create_table :settings do |t| - t.column :name, :string, :limit => 255 - t.column :value, :string, :limit => 255 - t.column :position, :integer - t.column :blog_id, :integer - end - end -end diff --git a/db/migrate/101_adds_content_type.rb b/db/migrate/101_adds_content_type.rb deleted file mode 100644 index d131c66012..0000000000 --- a/db/migrate/101_adds_content_type.rb +++ /dev/null @@ -1,16 +0,0 @@ -class AddsContentType < ActiveRecord::Migration - def self.up - add_column :contents, :post_type, :string, :default => 'read' - - create_table :post_types do |t| - t.column :name, :string - t.column :permalink, :string - t.column :description, :string - end - end - - def self.down - remove_column :contents, :post_type - drop_table :post_types - end -end diff --git a/db/migrate/102_fixes_existing_articles_with_no_type.rb b/db/migrate/102_fixes_existing_articles_with_no_type.rb deleted file mode 100644 index 7d2cf27167..0000000000 --- a/db/migrate/102_fixes_existing_articles_with_no_type.rb +++ /dev/null @@ -1,20 +0,0 @@ -class FixesExistingArticlesWithNoType < ActiveRecord::Migration - - class Content < ActiveRecord::Base - end - class Article < Content - end - - - def self.up - say "Fixes existing articles with no post types" - Article.find(:all).each do |art| - art.post_type = "read" if art.post_type.empty? - art.save! - end - end - - def self.down - say "This migration does absolutely nothing" - end -end diff --git a/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb b/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb deleted file mode 100644 index db98a91168..0000000000 --- a/db/migrate/103_really_update_existing_articles_with_nil_or_empty_post_type.rb +++ /dev/null @@ -1,27 +0,0 @@ -class ReallyUpdateExistingArticlesWithNilOrEmptyPostType < ActiveRecord::Migration - class Content < ActiveRecord::Base - inheritance_column = :ignore_inheritance_column - end - - def self.up - say_with_time "Really fix existing articles with no post type." do - Content.find(:all, - :conditions => ['type = ?', 'Article']).each do |art| - if art.post_type.nil? or art.post_type.empty? - say "Fixing '#{art.title}'", 1 - art.post_type = "read" - - # this doesn't really belong here but since this migration - # would otherwise reset tags, it's better than nothing. - art.keywords = art.tags.collect(&:name).join(" ") - - art.save! - end - end - end - end - - def self.down - say "This rollback does nothing, but that's okay." - end -end diff --git a/db/migrate/104_adds_created_at_to_redirects.rb b/db/migrate/104_adds_created_at_to_redirects.rb deleted file mode 100644 index 3751c94411..0000000000 --- a/db/migrate/104_adds_created_at_to_redirects.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AddsCreatedAtToRedirects < ActiveRecord::Migration - - def self.up - add_column :redirects, :created_at, :datetime - add_column :redirects, :updated_at, :datetime - - end - - def self.down - remove_column :redirects, :created_at - remove_column :redirects, :updated_at - end -end - diff --git a/db/schema.mysql-v3.sql b/db/schema.mysql-v3.sql deleted file mode 100644 index 236e981c37..0000000000 --- a/db/schema.mysql-v3.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Leaving this file empty forces the whole migration --- and fixes a bug when using Typo installer. --- Please, leave them as is. \ No newline at end of file diff --git a/db/schema.mysql.sql b/db/schema.mysql.sql deleted file mode 100644 index 236e981c37..0000000000 --- a/db/schema.mysql.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Leaving this file empty forces the whole migration --- and fixes a bug when using Typo installer. --- Please, leave them as is. \ No newline at end of file diff --git a/db/schema.postgresql.sql b/db/schema.postgresql.sql deleted file mode 100644 index 236e981c37..0000000000 --- a/db/schema.postgresql.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Leaving this file empty forces the whole migration --- and fixes a bug when using Typo installer. --- Please, leave them as is. \ No newline at end of file diff --git a/db/schema.sqlite.sql b/db/schema.sqlite.sql deleted file mode 100644 index 236e981c37..0000000000 --- a/db/schema.sqlite.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Leaving this file empty forces the whole migration --- and fixes a bug when using Typo installer. --- Please, leave them as is. \ No newline at end of file diff --git a/db/schema.sqlite3.sql b/db/schema.sqlite3.sql deleted file mode 100644 index 236e981c37..0000000000 --- a/db/schema.sqlite3.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Leaving this file empty forces the whole migration --- and fixes a bug when using Typo installer. --- Please, leave them as is. \ No newline at end of file diff --git a/db/schema.sqlserver.sql b/db/schema.sqlserver.sql deleted file mode 100644 index 236e981c37..0000000000 --- a/db/schema.sqlserver.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Leaving this file empty forces the whole migration --- and fixes a bug when using Typo installer. --- Please, leave them as is. \ No newline at end of file diff --git a/db/schema_version b/db/schema_version deleted file mode 100644 index 8c0474e323..0000000000 --- a/db/schema_version +++ /dev/null @@ -1 +0,0 @@ -69 \ No newline at end of file diff --git a/db/scripts/fix_permalinks.rb b/db/scripts/fix_permalinks.rb deleted file mode 100755 index 0e9d6a6728..0000000000 --- a/db/scripts/fix_permalinks.rb +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/environment' -Article.find(:all).each do |a| - (puts "Processing #{a.title} (#{a.stripped_title})" ; a.save) if a.permalink.blank? -end diff --git a/db/seeds.rb b/db/seeds.rb deleted file mode 100644 index e62d0dfe5c..0000000000 --- a/db/seeds.rb +++ /dev/null @@ -1,44 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Mayor.create(:name => 'Daley', :city => cities.first) -Blog.create(:id => 1, :settings => {"canonical_server_url"=>""}, :base_url => "http://example.com/") -Category.create(:id => 1, :name => "General", :permalink => "general", :position => 1) -Profile.create(:id => 1, :label => "admin", :modules => [:dashboard, :articles, :pages, :media, :feedback, :themes, :sidebar, :users, :settings, :profile, :seo], :nicename => "Typo administrator") -Profile.create(:id => 2, :label => "publisher", :modules => [:dashboard, :articles, :media, :pages, :feedback, :profile], :nicename => "Blog publisher") -Profile.create(:id => 3, :label => "contributor", :modules => [:dashboard, :profile], :nicename => "Contributor") -Right.create(:description => "Global administration", :id => 1, :name => "admin") -Right.create(:description => "Create article", :id => 2, :name => "content_create") -Right.create(:description => "Edit article", :id => 3, :name => "content_edit") -Right.create(:description => "Delete article", :id => 4, :name => "content_delete") -Right.create(:description => "Create a category", :id => 5, :name => "category_create") -Right.create(:description => "Edit a category", :id => 6, :name => "category_edit") -Right.create(:description => "Delete a category", :id => 7, :name => "category_delete") -Right.create(:description => "Create a category", :id => 8, :name => "page_create") -Right.create(:description => "Edit a category", :id => 9, :name => "page_edit") -Right.create(:description => "Delete a category", :id => 10, :name => "page_delete") -Right.create(:description => "Add a comment", :id => 11, :name => "feedback_create") -Right.create(:description => "Edit self comments", :id => 12, :name => "feedback_self_edit") -Right.create(:description => "Edit any comment", :id => 13, :name => "feedback_edit") -Right.create(:description => "Delete self comments", :id => 14, :name => "feedback_self_delete") -Right.create(:description => "Delete any comment", :id => 15, :name => "feedback_delete") -Right.create(:description => "Create users", :id => 16, :name => "user_create") -Right.create(:description => "Edit users", :id => 17, :name => "user_edit") -Right.create(:description => "Edit self account", :id => 18, :name => "user_self_edit") -Right.create(:description => "Delete users", :id => 19, :name => "user_delete") -Sidebar.create(:active_position => 0, :config => {"maximum_pages"=>"10"}, :id => 1, :staged_position => 0, :type => "PageSidebar") -Sidebar.create(:active_position => 1, :config => {"empty"=>false, "count"=>true}, :id => 2, :staged_position => 1, :type => "CategorySidebar") -Sidebar.create(:active_position => 2, :config => {"show_count"=>true, "count"=>"10"}, :id => 3, :staged_position => 2, :type => "ArchivesSidebar") -Sidebar.create(:active_position => 3, :config => {"body"=>"\n", "title"=>"Links"}, :id => 4, :staged_position => 3, :type => "StaticSidebar") -Sidebar.create(:active_position => 4, :config => {"title"=>"Meta"}, :id => 5, :staged_position => 4, :type => "MetaSidebar") -TextFilter.create(:description => "None", :filters => [], :id => 1, :markup => "none", :name => "none", :params => {}) -TextFilter.create(:description => "Markdown", :filters => [], :id => 2, :markup => "markdown", :name => "markdown", :params => {}) -TextFilter.create(:description => "SmartyPants", :filters => [:smartypants], :id => 3, :markup => "none", :name => "smartypants", :params => {}) -TextFilter.create(:description => "Markdown with SmartyPants", :filters => [:smartypants], :id => 4, :markup => "markdown", :name => "markdown smartypants", :params => {}) -TextFilter.create(:description => "Textile", :filters => [], :id => 5, :markup => "textile", :name => "textile", :params => {}) -Article.create(:allow_comments => true, :allow_pings => true, :author => "Mr Typo", :body => "Welcome to Typo. This is your first article. Edit or delete it, then start blogging!", :guid => "1bf3e2ca-ed7b-4562-8a4a-8ce8438822c8", :id => 1, :permalink => "hello-world", :post_type => "read", :published => true, :published_at => "2012-06-09 21:51:55 UTC", :settings => {"password"=>""}, :state => "published", :text_filter_id => 5, :title => "Hello World!", :type => "Article", :user_id => 1) -Page.create(:body => "This is an example of a Typo page. You can edit this to write information about yourself or your site so readers know who you are. You can create as many pages as this one as you like and manage all of your content inside Typo.", :id => 2, :name => "about", :post_type => "read", :published => true, :published_at => "2012-06-09 21:51:55 UTC", :settings => {"password"=>""}, :state => "published", :text_filter_id => 5, :title => "about", :type => "Page", :user_id => 1) diff --git a/db/updates/update.168.to.200.mysql.sql b/db/updates/update.168.to.200.mysql.sql deleted file mode 100644 index 21aa4611fa..0000000000 --- a/db/updates/update.168.to.200.mysql.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE IF NOT EXISTS `blacklist_patterns` ( - `id` int(11) NOT NULL auto_increment, - `type` varchar(15) default NULL, - `pattern` varchar(255) default NULL, - PRIMARY KEY (`id`) -); - -CREATE TABLE IF NOT EXISTS `settings` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(40) default NULL, - `value` varchar(40) default NULL, - PRIMARY KEY (`id`) -); - -CREATE TABLE IF NOT EXISTS `sessions` ( - `id` int(11) unsigned NOT NULL auto_increment, - `sessid` varchar(32) default NULL, - `data` text, - `updated_at` datetime default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `sessid` (`sessid`) -); - -CREATE TABLE IF NOT EXISTS `users` ( - `id` int(11) NOT NULL auto_increment, - `login` varchar(80) default NULL, - `password` varchar(40) default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `login` (`login`) -); - -ALTER TABLE `comments` ADD `ip` varchar(15) DEFAULT NULL; -ALTER TABLE `articles` ADD `text_filter` varchar(20) DEFAULT NULL; diff --git a/db/updates/update.168.to.200.psql.sql b/db/updates/update.168.to.200.psql.sql deleted file mode 100644 index e27509927e..0000000000 --- a/db/updates/update.168.to.200.psql.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE blacklist_patterns ( - id SERIAL PRIMARY KEY NOT NULL, - type varchar(15) default NULL, - pattern varchar(255) default NULL -); - -CREATE TABLE sessions ( - id SERIAL PRIMARY KEY NOT NULL, - sessid varchar(255) default NULL, - data text, - created_at TIMESTAMP DEFAULT now(), - updated_at TIMESTAMP DEFAULT now() -); - -CREATE TABLE settings ( - id SERIAL PRIMARY KEY NOT NULL, - name varchar(255) default NULL, - value varchar(255) default NULL, - position int default NULL -); - -CREATE TABLE users ( - id SERIAL PRIMARY KEY NOT NULL, - login varchar(40) default NULL, - password varchar(40) default NULL, - UNIQUE (login) -); - -ALTER TABLE comments ADD ip varchar(15) DEFAULT NULL; -ALTER TABLE articles ADD text_filter varchar(20) DEFAULT NULL; From 44727807b633f1e3c42ea4cbe5620813eeae0998 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 13:53:35 -0700 Subject: [PATCH 17/19] web step for I have n articles published creates n number of articles --- features/step_definitions/web_steps.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index 2282fffb23..75ca29f768 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -32,6 +32,26 @@ end end +Given /^I have (\d+) articles published$/ do |num| + num.to_i.times do + Article.create!({:type => "Article", + :title => "Foobar #{num}", + :author => "Test User", + :body => "Lorem Ipsum #{num}", + :extended => nil, + :excerpt => nil, + :user_id => 1, + :published => true, + :allow_pings => nil, + :allow_comments => nil, + :published_at => nil, + :state => "published", + :parent_id => nil, + :settings => {}, + :post_type => "read"}) + end +end + require 'uri' require 'cgi' require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) From 36d799a2819d82241e81c2ec435b34439eee3e7d Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 13:54:08 -0700 Subject: [PATCH 18/19] outline for cucumber test of merge articles base feature --- features/merge_articles.feature | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 features/merge_articles.feature diff --git a/features/merge_articles.feature b/features/merge_articles.feature new file mode 100644 index 0000000000..5db98ffdda --- /dev/null +++ b/features/merge_articles.feature @@ -0,0 +1,21 @@ +Feature: Merge Articles + As a blog administrator + In order to reduce blog clutter + I want to be able to merge together any two articles + + Background: + Given the blog is set up + And I am logged into the admin panel + And I have 2 articles published + + Scenario: Successfully merege two articles + Given I am on the admin content page + When I follow "Foobar" + Then I should be on the admin content edit page + And I should see "Lorem Ipsum" + And I should see "Merge Articles" + When I fill in "Merge Articles" with "2" + And I press "Merge" + Then I should be on the article show page + And I should see "Your artices have successfully merged" + And I should see "Lorem Ipsum./nLorem Ipsum." From e02ae03edee72d233ce004c89573b42d93da0495 Mon Sep 17 00:00:00 2001 From: Lauren Granger Date: Tue, 29 Mar 2016 13:55:12 -0700 Subject: [PATCH 19/19] add path support for the admin content edit page --- features/support/paths.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/support/paths.rb b/features/support/paths.rb index e7e00e5d89..d62bcc1445 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -17,6 +17,8 @@ def path_to(page_name) '/' when /^the new article page$/ '/admin/content/new' + when /^the admin content edit page$/i + "/admin/content/edit/4" # Add more mappings here. # Here is an example that pulls values out of the Regexp: