Sha256: 19fdba7943f4444752bd0d5f21a84e1688924614c1a8ecc38e0e7a1cc1581502

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.5 db/migrate/upgrades/05_upgrade_to_1_4_0.rb
comfortable_mexican_sofa-1.4.4 db/migrate/upgrades/05_upgrade_to_1_4_0.rb
comfortable_mexican_sofa-1.4.3 db/migrate/upgrades/05_upgrade_to_1_4_0.rb
comfortable_mexican_sofa-1.4.2 db/migrate/upgrades/05_upgrade_to_1_4_0.rb
comfortable_mexican_sofa-1.4.1 db/migrate/upgrades/05_upgrade_to_1_4_0.rb
comfortable_mexican_sofa-1.4.0 db/migrate/upgrades/05_upgrade_to_1_4_0.rb