diff options
Diffstat (limited to 'db/migrate/20230405013826_create_carts.rb')
-rw-r--r-- | db/migrate/20230405013826_create_carts.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/db/migrate/20230405013826_create_carts.rb b/db/migrate/20230405013826_create_carts.rb index 8975e61..f66e030 100644 --- a/db/migrate/20230405013826_create_carts.rb +++ b/db/migrate/20230405013826_create_carts.rb @@ -1,9 +1,10 @@ class CreateCarts < ActiveRecord::Migration[7.0] def change create_table :carts do |t| - t.belongs_to :user_account, null: false, index: { unique: true }, foreign_key: true - t.timestamps end + + add_reference :user_accounts, :cart, foreign_key: true + add_reference :carts, :user_account, foreign_key: true end end |