aboutsummaryrefslogtreecommitdiff
path: root/db/migrate/20201005155004_create_agencies.rb
blob: ab7cb033d4b4ea88e6aba9ea6dcf63746785508a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
class CreateAgencies < ActiveRecord::Migration[6.0]
  def change
    create_table :agencies do |t|
      t.references :agent, null: false, foreign_key: true
      t.references :user, null: false, foreign_key: true
      t.integer :roles, default: 0, null: false, limit: 2

      t.timestamps
    end
    add_index :agencies, [:agent_id, :user_id], unique: true
  end
end