diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20201005154908_create_agents.rb | 11 | ||||
-rw-r--r-- | db/migrate/20201005155004_create_agencies.rb | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/db/migrate/20201005154908_create_agents.rb b/db/migrate/20201005154908_create_agents.rb new file mode 100644 index 0000000..32792ee --- /dev/null +++ b/db/migrate/20201005154908_create_agents.rb @@ -0,0 +1,11 @@ +class CreateAgents < ActiveRecord::Migration[6.0] + def change + create_table :agents do |t| + t.string :name + t.uuid :uuid + + t.timestamps + end + add_index :agents, [:uuid], unique: true + end +end 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 |