From b9e6c425a6142b2b78311cfc7b51aa0de7481440 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Tue, 11 Apr 2023 20:28:11 -0600 Subject: Añadidos modelos para órdenes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20230412015748_create_orders.rb | 10 ++++++++++ db/migrate/20230412015828_create_payments.rb | 11 +++++++++++ db/migrate/20230412015843_add_payment_to_order.rb | 7 +++++++ db/migrate/20230412020105_create_product_orders.rb | 11 +++++++++++ 4 files changed, 39 insertions(+) create mode 100644 db/migrate/20230412015748_create_orders.rb create mode 100644 db/migrate/20230412015828_create_payments.rb create mode 100644 db/migrate/20230412015843_add_payment_to_order.rb create mode 100644 db/migrate/20230412020105_create_product_orders.rb (limited to 'db/migrate') diff --git a/db/migrate/20230412015748_create_orders.rb b/db/migrate/20230412015748_create_orders.rb new file mode 100644 index 0000000..db8ea6f --- /dev/null +++ b/db/migrate/20230412015748_create_orders.rb @@ -0,0 +1,10 @@ +class CreateOrders < ActiveRecord::Migration[7.0] + def change + create_table :orders do |t| + t.references :user_account, null: false, foreign_key: true + t.string :public_id + + t.timestamps + end + end +end diff --git a/db/migrate/20230412015828_create_payments.rb b/db/migrate/20230412015828_create_payments.rb new file mode 100644 index 0000000..d3adeaa --- /dev/null +++ b/db/migrate/20230412015828_create_payments.rb @@ -0,0 +1,11 @@ +class CreatePayments < ActiveRecord::Migration[7.0] + def change + create_table :payments do |t| + t.references :order, null: false, foreign_key: true + t.references :card, null: false, foreign_key: true + t.float :total + + t.timestamps + end + end +end diff --git a/db/migrate/20230412015843_add_payment_to_order.rb b/db/migrate/20230412015843_add_payment_to_order.rb new file mode 100644 index 0000000..90caab6 --- /dev/null +++ b/db/migrate/20230412015843_add_payment_to_order.rb @@ -0,0 +1,7 @@ +class AddPaymentToOrder < ActiveRecord::Migration[7.0] + def change + change_table(:orders) do |t| + t.references :payment, null: false, foreign_key: true + end + end +end diff --git a/db/migrate/20230412020105_create_product_orders.rb b/db/migrate/20230412020105_create_product_orders.rb new file mode 100644 index 0000000..1b2494b --- /dev/null +++ b/db/migrate/20230412020105_create_product_orders.rb @@ -0,0 +1,11 @@ +class CreateProductOrders < ActiveRecord::Migration[7.0] + def change + create_table :product_orders do |t| + t.references :order, null: false, foreign_key: true + t.references :product, null: false, foreign_key: true + t.integer :quantity + + t.timestamps + end + end +end -- cgit v1.2.3