diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20230412015748_create_orders.rb | 10 | ||||
-rw-r--r-- | db/migrate/20230412015828_create_payments.rb | 11 | ||||
-rw-r--r-- | db/migrate/20230412015843_add_payment_to_order.rb | 7 | ||||
-rw-r--r-- | db/migrate/20230412020105_create_product_orders.rb | 11 |
4 files changed, 39 insertions, 0 deletions
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 |