Sha256: 1e5882ce79f28d225880822a04c48b1e1cc7d53d363274d404552167cc67c014

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

class CreateCheckouts < ActiveRecord::Migration[5.1]
  def self.up
    create_table :checkouts do |t|
      t.integer :user_id
      t.integer :item_id, null: false
      t.integer :checkin_id
      t.integer :librarian_id
      t.integer :basket_id
      t.datetime :due_date
      t.integer :checkout_renewal_count, default: 0, null: false
      t.integer :lock_version, default: 0, null: false
      t.timestamps
    end
    add_index :checkouts, :user_id
    add_index :checkouts, :item_id
    add_index :checkouts, :basket_id
    add_index :checkouts, [:item_id, :basket_id], unique: true
    add_index :checkouts, :librarian_id
    add_index :checkouts, :checkin_id
  end

  def self.down
    drop_table :checkouts
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enju_seed-0.4.0.beta.1 spec/dummy/db/migrate/033_create_checkouts.rb