Class: CreatePagesAndCategories

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

Class Method Summary collapse

Class Method Details

.downObject



32
33
34
35
# File 'lib/generators/merrycms/templates/create_pages_and_categories_migration.rb', line 32

def self.down
  drop_table :pages
  drop_table :categories
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
# File 'lib/generators/merrycms/templates/create_pages_and_categories_migration.rb', line 2

def self.up
  create_table :pages do |t|
    t.string  :title
    t.text    :content
    t.text    :content_html
    t.string  :link
    t.string  :state
    t.datetime :published_at
    t.datetime :archived_at
    t.integer   :category_id
    t.timestamps
  end
  
  create_table :categories do |t|
    t.string  :name
    
    # nested_sey
    t.integer :parent_id
    t.integer :lft
    t.integer :rgt
    t.integer :depth

    # acts_as_list
    t.integer :position
    
    t.string  :link
    t.timestamps
  end
end