Class: CreatePages

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

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
19
20
# File 'lib/generators/tkh_content/create_or_update_migrations/templates/create_pages.rb', line 16

def self.down
  drop_table :pages
  Page.drop_translation_table!
  remove_index :pages, :published_at
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/tkh_content/create_or_update_migrations/templates/create_pages.rb', line 3

def self.up
  create_table :pages do |t|
    t.string :title
    t.text :description
    t.text :body
    t.boolean :for_blog, default: false
    t.datetime  :published_at
    t.timestamps
  end
  add_index :pages, :published_at
  Page.create_translation_table! :title => :string, :short_title => :string, :description => :text, :body => :text
end