Class: DraftingMigration

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

Class Method Summary collapse

Class Method Details

.downObject



14
15
16
# File 'lib/generators/drafting/migration/templates/migration.rb', line 14

def self.down
  drop_table :drafts
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/drafting/migration/templates/migration.rb', line 2

def self.up
  create_table :drafts do |t|
    t.string :target_type, :null => false
    t.references :user
    t.references :parent, :polymorphic => true, :index => true
    t.binary :data, :limit => 16777215, :null => false
    t.datetime :updated_at, :null => false
  end

  add_index :drafts, [:user_id, :target_type]
end