class DraftingMigration

Public Class Methods

down() click to toggle source
# File lib/generators/drafting/migration/templates/migration.rb, line 14
def self.down
  drop_table :drafts
end
up() click to toggle source
# 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