Class: CreateBlogComments
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateBlogComments
- Defined in:
- lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
19 20 21 22 |
# File 'lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb', line 19 def self.down remove_index :blog_comments, :blog_post_id drop_table :blog_comments end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb', line 2 def self.up create_table :blog_comments do |t| t.column :blog_post_id, :integer t.column :user_id, :integer t.column :user_ip, :string t.column :user_agent, :string t.column :referrer, :string t.column :name, :string t.column :site_url, :string t.column :email, :string t.column :body, :text t.column :created_at, :datetime end add_index :blog_comments, :blog_post_id end |