Class: SunriseCreatePosts
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- SunriseCreatePosts
- Defined in:
- lib/generators/sunrise/posts/templates/create_posts.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
21 22 23 |
# File 'lib/generators/sunrise/posts/templates/create_posts.rb', line 21 def self.down drop_table :posts end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/sunrise/posts/templates/create_posts.rb', line 2 def self.up create_table :posts do |t| t.integer :structure_id t.string :title, :null => false # t.string :slug, :limit=>40, :null=>false t.text :content t.integer :kind, :limit => 1, :default => 0 t.integer :comments_count, :default=>0 t.integer :year, :limit => 4 t.datetime :published_at t. end add_index :posts, :structure_id add_index :posts, :year end |