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/schema.rb | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'db/schema.rb') diff --git a/db/schema.rb b/db/schema.rb index 6a0f312..4564cc7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_04_05_015505) do +ActiveRecord::Schema[7.0].define(version: 2023_04_12_020105) do create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -76,6 +76,26 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_05_015505) do t.datetime "updated_at", null: false end + create_table "orders", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + t.bigint "user_account_id", null: false + t.string "public_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "payment_id", null: false + t.index ["payment_id"], name: "index_orders_on_payment_id" + t.index ["user_account_id"], name: "index_orders_on_user_account_id" + end + + create_table "payments", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + t.bigint "order_id", null: false + t.bigint "card_id", null: false + t.float "total" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["card_id"], name: "index_payments_on_card_id" + t.index ["order_id"], name: "index_payments_on_order_id" + end + create_table "product_carts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| t.integer "quantity" t.bigint "cart_id" @@ -87,6 +107,16 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_05_015505) do t.index ["product_id"], name: "index_product_carts_on_product_id" end + create_table "product_orders", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + t.bigint "order_id", null: false + t.bigint "product_id", null: false + t.integer "quantity" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["order_id"], name: "index_product_orders_on_order_id" + t.index ["product_id"], name: "index_product_orders_on_product_id" + end + create_table "product_reviews", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| t.bigint "user_account_id", null: false t.bigint "product_id", null: false @@ -113,10 +143,10 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_05_015505) do end create_table "user_account_addresses", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| - t.bigint "user_account_id", null: false - t.bigint "address_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.bigint "user_account_id" + t.bigint "address_id" t.index ["address_id", "user_account_id"], name: "index_user_account_addresses_on_address_id_and_user_account_id", unique: true t.index ["address_id"], name: "index_user_account_addresses_on_address_id" t.index ["user_account_id"], name: "index_user_account_addresses_on_user_account_id" @@ -139,10 +169,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_05_015505) do add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "cards", "user_accounts" add_foreign_key "carts", "user_accounts" + add_foreign_key "orders", "payments" + add_foreign_key "orders", "user_accounts" + add_foreign_key "payments", "cards" + add_foreign_key "payments", "orders" + add_foreign_key "product_orders", "orders" + add_foreign_key "product_orders", "products" add_foreign_key "product_reviews", "products" add_foreign_key "product_reviews", "user_accounts" add_foreign_key "products", "companies" - add_foreign_key "user_account_addresses", "addresses" - add_foreign_key "user_account_addresses", "user_accounts" add_foreign_key "user_accounts", "carts" end -- cgit v1.2.3