skala mini project
Tables (8)
products
- id — BIGINT — Primary key — NOT NULL
- store_id — BIGINT — Foreign key → stores.id — NOT NULL
- name — VARCHAR(255) — NOT NULL
- price — INT — NOT NULL
- discount_rate — DECIMAL(4,2) — NOT NULL
- created_at — TIMESTAMP — NOT NULL
- updated_at — TIMESTAMP — NOT NULL
reservation_items
- id — BIGINT — Primary key — NOT NULL
- reservation_id — BIGINT — Foreign key → reservations.id — NOT NULL
- sale_item_id — BIGINT — Foreign key → sale_items.id — NOT NULL
- qty — INT — NOT NULL
- unit_price — INT — NOT NULL
reservation_status_logs
- id — BIGINT — Primary key — NOT NULL
- reservation_id — BIGINT — Foreign key → reservations.id — NOT NULL
- from_status — VARCHAR(20)
- to_status — VARCHAR(20) — NOT NULL
- changed_by — BIGINT — Foreign key → users.id
- changed_at — TIMESTAMP — NOT NULL
reservations
- id — BIGINT — Primary key — NOT NULL
- customer_id — BIGINT — Foreign key → users.id — NOT NULL
- sale_id — BIGINT — Foreign key → sales.id — NOT NULL
- status — VARCHAR(20) — NOT NULL
- pickup_code — VARCHAR(4) — NOT NULL
- pickup_time — TIMESTAMP — NOT NULL
- idempotency_key — VARCHAR(255) — NOT NULL
- reserved_at — TIMESTAMP — NOT NULL
- picked_up_at — TIMESTAMP
- cancelled_at — TIMESTAMP
sale_items
- id — BIGINT — Primary key — NOT NULL
- sale_id — BIGINT — Foreign key → sales.id — NOT NULL
- product_id — BIGINT — Foreign key → products.id — NOT NULL
- product_name — VARCHAR(255) — NOT NULL
- original_price — INT — NOT NULL
- discount_rate — DECIMAL(4,2) — NOT NULL
- sale_price — INT — NOT NULL
- remaining_qty — INT — NOT NULL
- status — VARCHAR(20) — NOT NULL
- created_at — TIMESTAMP — NOT NULL
sales
- id — BIGINT — Primary key — NOT NULL
- store_id — BIGINT — Foreign key → stores.id — NOT NULL
- sale_date — DATE — NOT NULL
- pickup_deadline — TIMESTAMP — NOT NULL
- status — VARCHAR(20) — NOT NULL
- created_at — TIMESTAMP — NOT NULL
stores
- id — BIGINT — Primary key — NOT NULL
- owner_id — BIGINT — Foreign key → users.id — NOT NULL
- name — VARCHAR(255) — NOT NULL
- address — VARCHAR(255) — NOT NULL
- latitude — DECIMAL(9,6) — NOT NULL
- longitude — DECIMAL(9,6) — NOT NULL
- phone — VARCHAR(50) — NOT NULL
- business_open — TIME — NOT NULL
- business_close — TIME — NOT NULL
- pickup_open — TIME — NOT NULL
- pickup_close — TIME — NOT NULL
- cancel_before_minutes — INT — NOT NULL
- created_at — TIMESTAMP — NOT NULL
users
- id — BIGINT — Primary key — NOT NULL
- provider — VARCHAR(20) — NOT NULL
- provider_id — VARCHAR(255) — NOT NULL
- display_name — VARCHAR(255) — NOT NULL
- role — VARCHAR(20)
- created_at — TIMESTAMP — NOT NULL