diff --git a/db/migrate/20181129203927_devise_create_users.rb b/db/migrate/20181129203927_devise_create_users.rb index 4b3ddc7..ca9ea8b 100644 --- a/db/migrate/20181129203927_devise_create_users.rb +++ b/db/migrate/20181129203927_devise_create_users.rb @@ -11,6 +11,8 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2] t.string :guest_token, null: false + t.references :person, index: { unique: true } + t.index :guest_token, unique: true end @@ -100,5 +102,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2] add_foreign_key :users, :accounts add_foreign_key :account_roles, :accounts add_foreign_key :account_roles, :roles + add_foreign_key :accounts, :people end end diff --git a/db/migrate/20181210033307_add_person_to_accounts.rb b/db/migrate/20181210033307_add_person_to_accounts.rb deleted file mode 100644 index 34b4dab..0000000 --- a/db/migrate/20181210033307_add_person_to_accounts.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddPersonToAccounts < ActiveRecord::Migration[5.2] - def change - add_reference :accounts, :person, index: { unique: true }, foreign_key: true - end -end