From 96ce018912ceffb7270b883a8982b1e2403cda1c Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Tue, 4 Apr 2023 20:08:37 -0600 Subject: AƱade modelo ProductCart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20230405015505_create_product_carts.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 db/migrate/20230405015505_create_product_carts.rb (limited to 'db/migrate/20230405015505_create_product_carts.rb') diff --git a/db/migrate/20230405015505_create_product_carts.rb b/db/migrate/20230405015505_create_product_carts.rb new file mode 100644 index 0000000..4cafb27 --- /dev/null +++ b/db/migrate/20230405015505_create_product_carts.rb @@ -0,0 +1,13 @@ +class CreateProductCarts < ActiveRecord::Migration[7.0] + def change + create_table :product_carts do |t| + t.integer :quantity + t.belongs_to :cart, index: true + t.belongs_to :product, index: true + + t.timestamps + end + + add_index(:product_carts, [:product_id, :cart_id], unique: true) + end +end -- cgit v1.2.3