Class: CreateCms

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

Instance Method Summary collapse

Instance Method Details

#changeObject



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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rails/generators/kealy_cms/templates/create_cms.rb', line 2

def change
  create_table :posts do |t|
    t.string :title
    t.text :content
    t.integer :post_id

    t.timestamps
  end
  create_table :categories do |t|
    t.string :title
    t.text :content

    t.timestamps
  end
  create_table :pages do |t|
    t.string :title
    t.integer :parent_id

    t.timestamps
  end

  create_table :tags do |t|
    t.string :name
  end

  create_table :page_parts do |t|
    t.string :title
    t.text :content
    t.integer :page_id

    t.timestamps
  end

  create_table :posts_tags, :id => false do |t|
    t.integer :post_id
    t.integer :tag_id
  end
  create_table :categories_posts, :id => false do |t|
    t.integer :post_id
    t.integer :category_id
  end
  create_table :categories_pages, :id => false do |t|
    t.integer :page_id
    t.integer :category_id
  end

  create_table :comments do |t|
    t.integer :user_id
    t.integer :parent_id
    t.integer :post_id
    t.boolean :approved
    t.string :author
    t.string :author_website
    t.string :author_email
    t.text :content

    t.timestamps
  end
end