Class: ApiDocsCreate

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

Instance Method Summary collapse

Instance Method Details

#downObject



22
23
24
25
26
# File 'lib/generators/active_record/templates/migration.rb', line 22

def down
  drop_table :docs_pages
  drop_table :docs_page_categories
  disable_extension :hstore    
end

#upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/active_record/templates/migration.rb', line 2

def up
  enable_extension :hstore

  create_table :docs_page_categories do |t|
    t.string :slug, index: { unique: true }
    t.string :title
    t.text :body
  end
  
  create_table :docs_pages do |t|
    t.belongs_to :page_category, index: true
    t.string :path
    t.string :via
    t.string :title
    t.text :body
    t.text :example
    t.hstore :data
  end
end