Class: CortexReaver::PageSchema

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/cortex_reaver/migrations/002_pages.rb

Instance Method Summary collapse

Instance Method Details

#downObject



3
4
5
# File 'lib/cortex_reaver/migrations/002_pages.rb', line 3

def down
  drop_table :pages if table_exists? :pages
end

#upObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cortex_reaver/migrations/002_pages.rb', line 7

def up
  unless table_exists? :pages
    create_table :pages do
      primary_key :id

      foreign_key :user_id, :table => :users
      index :user_id

      varchar :name, :null => false, :unique => true, :index => true
      varchar :title, :null => false

      text :body, :default => ''
      text :body_cache, :default => ''

      integer :comment_count, :null => false, :default => 0

      datetime :created_on, :null => false
      datetime :updated_on, :null => false
    end
  end
end