Sha256: 85287812af4e5c2d1635098c509ca5fefc914fe3352e66aef3dc509dd8dba2ad

Contents?: true

Size: 730 Bytes

Versions: 8

Compression:

Stored size: 730 Bytes

Contents

class CreateCheckouts < ActiveRecord::Migration[4.2]
  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, %i[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

8 entries across 8 versions & 2 rubygems

Version Path
enju_leaf-1.3.2 spec/dummy/db/migrate/033_create_checkouts.rb
enju_biblio-0.3.2 spec/dummy/db/migrate/033_create_checkouts.rb
enju_leaf-1.3.1 spec/dummy/db/migrate/033_create_checkouts.rb
enju_biblio-0.3.1 spec/dummy/db/migrate/033_create_checkouts.rb
enju_leaf-1.3.0 spec/dummy/db/migrate/033_create_checkouts.rb
enju_biblio-0.3.0 spec/dummy/db/migrate/033_create_checkouts.rb
enju_leaf-1.3.0.rc.1 spec/dummy/db/migrate/033_create_checkouts.rb
enju_biblio-0.3.0.rc.1 spec/dummy/db/migrate/033_create_checkouts.rb