Class: CreateBookSequels

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/dummy/templates/migrations/create_book_sequels.rb

Instance Method Summary collapse

Instance Method Details

#downObject


11
12
13
# File 'lib/generators/dummy/templates/migrations/create_book_sequels.rb', line 11

def down
  drop_table :book_sequels
end

#upObject


2
3
4
5
6
7
8
9
# File 'lib/generators/dummy/templates/migrations/create_book_sequels.rb', line 2

def up
  create_table :book_sequels do |t|
    t.integer :book_id, null: false
    t.integer :sequel_id, null: false
  end

  add_index :book_sequels, [:book_id, :sequel_id], unique: true
end