reestablish ActiveRecord::Base connection at the end of migrations for schema dump

Jeremy Steinberg committed Sep 02, 2011
commit 1c3b60be9a981b5f6a24d0bb770004f2e582ecff
Showing 5 changed files with 12 additions and 0 deletions
migrate/01_create_cms.rb b/db/migrate/01_create_cms.rb +4 -0
@@ @@ -107,6 +107,8 @@ class CreateCms < ActiveRecord::Migration
end
add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true,
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
+
+ ActiveRecord::Base.establish_connection
end
def self.down
@@ @@ -122,5 +124,7 @@ class CreateCms < ActiveRecord::Migration
drop_table :cms_revisions
drop_table :cms_categories
drop_table :cms_categorizations
+
+ ActiveRecord::Base.establish_connection
end
end
migrate/upgrades/02_upgrade_to_1_1_0.rb b/db/migrate/upgrades/02_upgrade_to_1_1_0.rb +2 -0
@@ @@ -7,6 +7,7 @@ class UpgradeTo110 < ActiveRecord::Migration
rename_column :cms_blocks, :cms_page_id, :page_id
rename_column :cms_snippets, :cms_site_id, :site_id
rename_column :cms_uploads, :cms_site_id, :site_id
+ ActiveRecord::Base.establish_connection
end
def self.down
@@ @@ -17,5 +18,6 @@ class UpgradeTo110 < ActiveRecord::Migration
rename_column :cms_layouts, :site_id, :cms_site_id
rename_column :cms_pages, :layout_id, :cms_layout_id
rename_column :cms_pages, :site_id, :cms_site_id
+ ActiveRecord::Base.establish_connection
end
end
\ No newline at end of file
migrate/upgrades/03_upgrade_to_1_2_0.rb b/db/migrate/upgrades/03_upgrade_to_1_2_0.rb +2 -0
@@ @@ -8,10 +8,12 @@ class UpgradeTo120 < ActiveRecord::Migration
t.datetime :created_at
end
add_index :cms_revisions, [:record_type, :record_id, :created_at]
+ ActiveRecord::Base.establish_connection
end
def self.down
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
drop_table :cms_revisions
+ ActiveRecord::Base.establish_connection
end
end
\ No newline at end of file
migrate/upgrades/04_upgrade_to_1_3_0.rb b/db/migrate/upgrades/04_upgrade_to_1_3_0.rb +2 -0
@@ @@ -9,6 +9,7 @@ class UpgradeTo130 < ActiveRecord::Migration
add_column :cms_layouts, :is_shared, :boolean, :null => false, :default => false
add_column :cms_pages, :is_shared, :boolean, :null => false, :default => false
add_column :cms_snippets, :is_shared, :boolean, :null => false, :default => false
+ ActiveRecord::Base.establish_connection
end
def self.down
@@ @@ -21,5 +22,6 @@ class UpgradeTo130 < ActiveRecord::Migration
remove_column :cms_layouts, :is_shared
remove_column :cms_pages, :is_shared
remove_column :cms_snippets, :is_shared
+ ActiveRecord::Base.establish_connection
end
end
\ No newline at end of file
migrate/upgrades/05_upgrade_to_1_4_0.rb b/db/migrate/upgrades/05_upgrade_to_1_4_0.rb +2 -0
@@ @@ -20,6 +20,7 @@ class UpgradeTo140 < ActiveRecord::Migration
end
add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true,
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
+ ActiveRecord::Base.establish_connection
end
def self.down
@@ @@ -31,5 +32,6 @@ class UpgradeTo140 < ActiveRecord::Migration
drop_table :cms_categories
drop_table :cms_categorizations
+ ActiveRecord::Base.establish_connection
end
end
\ No newline at end of file