diff options
Diffstat (limited to 'db/migrate/20201005155004_create_agencies.rb')
-rw-r--r-- | db/migrate/20201005155004_create_agencies.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/db/migrate/20201005155004_create_agencies.rb b/db/migrate/20201005155004_create_agencies.rb new file mode 100644 index 0000000..ab7cb03 --- /dev/null +++ b/db/migrate/20201005155004_create_agencies.rb @@ -0,0 +1,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 |