Class: CreateBlogImages

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb

Class Method Summary collapse

Class Method Details

.downObject



15
16
17
18
# File 'lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb', line 15

def self.down
  remove_index :blog_images, :blog_post_id
  drop_table :blog_images
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb', line 2

def self.up
  create_table :blog_images, :force => true do |t|
    t.string :image_file_name
    t.string :image_content_type
    t.integer :image_file_size
    t.datetime :image_updated_at
    t.integer :blog_post_id
    t.timestamps
  end

  add_index :blog_images, :blog_post_id
end