class CreateLibraryBibContributors < ActiveRecord::Migration[6.0]
  def change
    create_table :library_bib_contributors do |t|
      t.references :bib, null: false, index: false,
        foreign_key: { to_table: :library_bibs }
      t.references :contributor, null: false, index: false,
        foreign_key: { to_table: :library_contributors }

      t.integer :type, null: false

      t.timestamps

      t.index [:bib_id, :contributor_id], unique: true
    end
  end
end
