Sha256: 23fa95b0619213d8a07989b3cfb2c8af5d29c94fb4aa8c71eafca0ae45f8f92f

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

class CreateCheckouts < ActiveRecord::Migration[5.0]
  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.3.0.beta.4 spec/dummy/db/migrate/033_create_checkouts.rb