fixing deprecation warnings for rails 3.2 and moving upgrade migrations folder

Oleg committed Dec 22, 2011
commit a8ff763c281686a287e21e1df62b8096690f4366
Showing 21 changed files with 145 additions and 145 deletions
app/models/cms/block.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Block < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_blocks
+ self.table_name = 'cms_blocks'
# -- Relationships --------------------------------------------------------
belongs_to :page
app/models/cms/categorization.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Categorization < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_categorizations
+ self.table_name = 'cms_categorizations'
# -- Relationships --------------------------------------------------------
belongs_to :category
app/models/cms/category.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Category < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_categories
+ self.table_name = 'cms_categories'
# -- Relationships --------------------------------------------------------
belongs_to :site
app/models/cms/file.rb +1 -1
@@ @@ -4,7 +4,7 @@ class Cms::File < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_files
+ self.table_name = 'cms_files'
cms_is_categorized
app/models/cms/layout.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Layout < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_layouts
+ self.table_name = 'cms_layouts'
cms_acts_as_tree
cms_is_mirrored
app/models/cms/page.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Page < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_pages
+ self.table_name = 'cms_pages'
cms_acts_as_tree :counter_cache => :children_count
cms_is_categorized
app/models/cms/revision.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Revision < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_revisions
+ self.table_name = 'cms_revisions'
serialize :data
app/models/cms/site.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Site < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_sites
+ self.table_name = 'cms_sites'
# -- Relationships --------------------------------------------------------
has_many :layouts, :dependent => :destroy
app/models/cms/snippet.rb +1 -1
@@ @@ -2,7 +2,7 @@ class Cms::Snippet < ActiveRecord::Base
ComfortableMexicanSofa.establish_connection(self)
- set_table_name :cms_snippets
+ self.table_name = 'cms_snippets'
cms_is_categorized
cms_is_mirrored
migrate/upgrades/02_upgrade_to_1_1_0.rb b/db/migrate/upgrades/02_upgrade_to_1_1_0.rb +0 -19
@@ @@ -1,19 +0,0 @@
- class UpgradeTo110 < ActiveRecord::Migration
- def self.up
- rename_column :cms_layouts, :cms_site_id, :site_id
- rename_column :cms_pages, :cms_site_id, :site_id
- rename_column :cms_pages, :cms_layout_id, :layout_id
- 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
- end
-
- def self.down
- rename_column :cms_uploads, :site_id, :cms_site_id
- rename_column :cms_snippets, :site_id, :cms_site_id
- rename_column :cms_blocks, :page_id, :cms_page_id
- 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
- 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 +0 -15
@@ @@ -1,15 +0,0 @@
- class UpgradeTo120 < ActiveRecord::Migration
- def self.up
- create_table :cms_revisions, :force => true do |t|
- t.string :record_type
- t.integer :record_id
- t.text :data
- t.datetime :created_at
- end
- add_index :cms_revisions, [:record_type, :record_id, :created_at]
- end
-
- def self.down
- drop_table :cms_revisions
- 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 +0 -23
@@ @@ -1,23 +0,0 @@
- class UpgradeTo130 < ActiveRecord::Migration
- def self.up
- add_column :cms_sites, :is_mirrored, :boolean, :null => false, :default => false
- add_column :cms_sites, :path, :string
- add_column :cms_sites, :locale, :string, :null => false, :default => 'en'
- add_index :cms_sites, :is_mirrored
-
- 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
- end
-
- def self.down
- remove_index :cms_sites, :is_mirrored
- remove_column :cms_sites, :path
- remove_column :cms_sites, :is_mirrored
- remove_column :cms_sites, :locale
-
- remove_column :cms_layouts, :is_shared
- remove_column :cms_pages, :is_shared
- remove_column :cms_snippets, :is_shared
- 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 +0 -33
@@ @@ -1,33 +0,0 @@
- class UpgradeTo140 < ActiveRecord::Migration
- def self.up
- rename_table :cms_uploads, :cms_files
- add_column :cms_files, :label, :string
- add_column :cms_files, :description, :string, :limit => 2048
- add_index :cms_files, [:site_id, :label]
-
- # -- Categories ---------------------------------------------------------
- create_table :cms_categories, :force => true do |t|
- t.string :label
- t.string :categorized_type
- end
- add_index :cms_categories, [:categorized_type, :label], :unique => true
-
- create_table :cms_categorizations, :force => true do |t|
- t.integer :category_id
- t.string :categorized_type
- t.integer :categorized_id
- 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'
- end
-
- def self.down
- remove_index :cms_files, [:site_id, :label]
- remove_column :cms_files, :description
- remove_column :cms_files, :label
- rename_table :cms_files, :cms_uploads
-
- drop_table :cms_categories
- drop_table :cms_categorizations
- end
- end
\ No newline at end of file
migrate/upgrades/06_upgrade_to_1_5_0.rb b/db/migrate/upgrades/06_upgrade_to_1_5_0.rb +0 -21
@@ @@ -1,21 +0,0 @@
- class UpgradeTo150 < ActiveRecord::Migration
- def self.up
- add_column :cms_snippets, :position, :integer, :null => false, :default => 0
- add_column :cms_files, :position, :integer, :null => false, :default => 0
- add_column :cms_files, :block_id, :integer
-
- add_index :cms_snippets, [:site_id, :position]
- add_index :cms_files, [:site_id, :position]
- add_index :cms_files, [:site_id, :block_id]
- end
-
- def self.down
- remove_index :cms_snippets, [:site_id, :position]
- remove_index :cms_files, [:site_id, :position]
- remove_index :cms_files, [:site_id, :block_id]
-
- remove_column :cms_snippets, :position
- remove_column :cms_files, :position
- remove_column :cms_files, :block_id
- end
- end
migrate/upgrades/07_upgrade_to_1_6_0.rb b/db/migrate/upgrades/07_upgrade_to_1_6_0.rb +0 -25
@@ @@ -1,25 +0,0 @@
- class UpgradeTo160 < ActiveRecord::Migration
- def self.up
- add_column :cms_sites, :identifier, :string, :null => false
- add_index :cms_sites, :identifier
-
- rename_column :cms_layouts, :slug, :identifier
- rename_column :cms_blocks, :label, :identifier
- rename_column :cms_snippets, :slug, :identifier
-
- add_column :cms_categories, :site_id, :integer, :null => :false
- add_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true
- end
-
- def self.down
- remove_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true
- remove_column :cms_categories, :site_id
-
- rename_column :cms_snippets, :identifier, :slug
- rename_column :cms_blocks, :identifier, :label
- rename_column :cms_layouts, :identifier, :slug
-
- remove_index :cms_sites, :identifier
- remove_column :cms_sites, :identifier
- end
- end
\ No newline at end of file
upgrade_migrations/02_upgrade_to_1_1_0.rb b/db/upgrade_migrations/02_upgrade_to_1_1_0.rb +19 -0
@@ @@ -0,0 +1,19 @@
+ class UpgradeTo110 < ActiveRecord::Migration
+ def self.up
+ rename_column :cms_layouts, :cms_site_id, :site_id
+ rename_column :cms_pages, :cms_site_id, :site_id
+ rename_column :cms_pages, :cms_layout_id, :layout_id
+ 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
+ end
+
+ def self.down
+ rename_column :cms_uploads, :site_id, :cms_site_id
+ rename_column :cms_snippets, :site_id, :cms_site_id
+ rename_column :cms_blocks, :page_id, :cms_page_id
+ 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
+ end
+ end
\ No newline at end of file
upgrade_migrations/03_upgrade_to_1_2_0.rb b/db/upgrade_migrations/03_upgrade_to_1_2_0.rb +15 -0
@@ @@ -0,0 +1,15 @@
+ class UpgradeTo120 < ActiveRecord::Migration
+ def self.up
+ create_table :cms_revisions, :force => true do |t|
+ t.string :record_type
+ t.integer :record_id
+ t.text :data
+ t.datetime :created_at
+ end
+ add_index :cms_revisions, [:record_type, :record_id, :created_at]
+ end
+
+ def self.down
+ drop_table :cms_revisions
+ end
+ end
\ No newline at end of file
upgrade_migrations/04_upgrade_to_1_3_0.rb b/db/upgrade_migrations/04_upgrade_to_1_3_0.rb +23 -0
@@ @@ -0,0 +1,23 @@
+ class UpgradeTo130 < ActiveRecord::Migration
+ def self.up
+ add_column :cms_sites, :is_mirrored, :boolean, :null => false, :default => false
+ add_column :cms_sites, :path, :string
+ add_column :cms_sites, :locale, :string, :null => false, :default => 'en'
+ add_index :cms_sites, :is_mirrored
+
+ 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
+ end
+
+ def self.down
+ remove_index :cms_sites, :is_mirrored
+ remove_column :cms_sites, :path
+ remove_column :cms_sites, :is_mirrored
+ remove_column :cms_sites, :locale
+
+ remove_column :cms_layouts, :is_shared
+ remove_column :cms_pages, :is_shared
+ remove_column :cms_snippets, :is_shared
+ end
+ end
\ No newline at end of file
upgrade_migrations/05_upgrade_to_1_4_0.rb b/db/upgrade_migrations/05_upgrade_to_1_4_0.rb +33 -0
@@ @@ -0,0 +1,33 @@
+ class UpgradeTo140 < ActiveRecord::Migration
+ def self.up
+ rename_table :cms_uploads, :cms_files
+ add_column :cms_files, :label, :string
+ add_column :cms_files, :description, :string, :limit => 2048
+ add_index :cms_files, [:site_id, :label]
+
+ # -- Categories ---------------------------------------------------------
+ create_table :cms_categories, :force => true do |t|
+ t.string :label
+ t.string :categorized_type
+ end
+ add_index :cms_categories, [:categorized_type, :label], :unique => true
+
+ create_table :cms_categorizations, :force => true do |t|
+ t.integer :category_id
+ t.string :categorized_type
+ t.integer :categorized_id
+ 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'
+ end
+
+ def self.down
+ remove_index :cms_files, [:site_id, :label]
+ remove_column :cms_files, :description
+ remove_column :cms_files, :label
+ rename_table :cms_files, :cms_uploads
+
+ drop_table :cms_categories
+ drop_table :cms_categorizations
+ end
+ end
\ No newline at end of file
upgrade_migrations/06_upgrade_to_1_5_0.rb b/db/upgrade_migrations/06_upgrade_to_1_5_0.rb +21 -0
@@ @@ -0,0 +1,21 @@
+ class UpgradeTo150 < ActiveRecord::Migration
+ def self.up
+ add_column :cms_snippets, :position, :integer, :null => false, :default => 0
+ add_column :cms_files, :position, :integer, :null => false, :default => 0
+ add_column :cms_files, :block_id, :integer
+
+ add_index :cms_snippets, [:site_id, :position]
+ add_index :cms_files, [:site_id, :position]
+ add_index :cms_files, [:site_id, :block_id]
+ end
+
+ def self.down
+ remove_index :cms_snippets, [:site_id, :position]
+ remove_index :cms_files, [:site_id, :position]
+ remove_index :cms_files, [:site_id, :block_id]
+
+ remove_column :cms_snippets, :position
+ remove_column :cms_files, :position
+ remove_column :cms_files, :block_id
+ end
+ end
upgrade_migrations/07_upgrade_to_1_6_0.rb b/db/upgrade_migrations/07_upgrade_to_1_6_0.rb +25 -0
@@ @@ -0,0 +1,25 @@
+ class UpgradeTo160 < ActiveRecord::Migration
+ def self.up
+ add_column :cms_sites, :identifier, :string, :null => false
+ add_index :cms_sites, :identifier
+
+ rename_column :cms_layouts, :slug, :identifier
+ rename_column :cms_blocks, :label, :identifier
+ rename_column :cms_snippets, :slug, :identifier
+
+ add_column :cms_categories, :site_id, :integer, :null => :false
+ add_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true
+ end
+
+ def self.down
+ remove_index :cms_categories, [:site_id, :categorized_type, :label], :unique => true
+ remove_column :cms_categories, :site_id
+
+ rename_column :cms_snippets, :identifier, :slug
+ rename_column :cms_blocks, :identifier, :label
+ rename_column :cms_layouts, :identifier, :slug
+
+ remove_index :cms_sites, :identifier
+ remove_column :cms_sites, :identifier
+ end
+ end
\ No newline at end of file