Class: CreateLiquidCmsUpgradeRev1

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/liquid_cms/templates/migration_rev1.rb

Class Method Summary collapse

Class Method Details

.downObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/liquid_cms/templates/migration_rev1.rb', line 27

def self.down
  drop_table :cms_taggings
  drop_table :cms_tags

  create_table :versions do |t|
  end

  change_table :cms_assets do |t|
    t.remove :custom_height, :custom_width, :meta_data
  end
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/liquid_cms/templates/migration_rev1.rb', line 2

def self.up
  change_table :cms_assets do |t|
    t.integer :custom_height
    t.integer :custom_width
    t.text :meta_data # serialized yaml
  end

  drop_table :versions

  create_table :cms_tags do |t|
    t.column :name, :string
  end
  
  create_table :cms_taggings do |t|
    t.column :tag_id, :integer
    t.column :taggable_id, :integer
    t.column :taggable_type, :string
    
    t.column :created_at, :datetime
  end
  
  add_index :cms_taggings, :tag_id
  add_index :cms_taggings, [:taggable_id, :taggable_type]
end