Class: CreateRcmsTables

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

Class Method Summary collapse

Class Method Details

.downObject



40
41
42
43
44
45
# File 'lib/generators/templates/migration.rb', line 40

def self.down
  drop_table :rcms_partials
  drop_table :rcms_meta_tags
  drop_table :rcms_meta_pages
  drop_table :rcms_pages
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
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/templates/migration.rb', line 2

def self.up
  create_table :rcms_partials do |t|
    t.string :placement
    t.string :description
    t.text :text

    t.timestamps
  end
  add_index :rcms_partials, :placement, unique: true

  create_table :rcms_meta_tags do |t|
    t.string :key
    t.text :text
    t.string :value
    t.references :target, polymorphic: true

    t.timestamps
  end

  create_table :rcms_meta_pages do |t|
    t.string :path

    t.timestamps
  end
  add_index :rcms_meta_pages, :path, unique: true

  create_table :rcms_pages do |t|
    t.string :slug
    t.string :title
    t.text :text
    t.boolean :is_active

    t.timestamps
  end
  add_index :rcms_pages, :slug, unique: true

end