summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-04-04 20:08:37 -0600
committerHombreLaser <sebastian-440@live.com>2023-04-04 20:08:37 -0600
commit96ce018912ceffb7270b883a8982b1e2403cda1c (patch)
tree7a427516c30f52f0d121e9bc31ae952a8713351b /db/migrate
parent18b129f8f6ba8c5c98adaf82ccfc4ba38264a29b (diff)
Añade modelo ProductCart
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20230405015505_create_product_carts.rb13
1 files changed, 13 insertions, 0 deletions
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