bazzar/migrations/20230603073532_checkouts.sql
2023-06-19 17:09:53 +02:00

41 lines
1.2 KiB
SQL

CREATE TYPE cart_types AS ENUM (
'default',
'swap',
'draft_order',
'payment_link',
'claim'
);
CREATE TABLE carts
(
id uuid NOT NULL,
email character varying,
billing_address_id uuid,
shipping_address_id uuid,
region_id uuid NOT NULL,
customer_id uuid,
payment_id uuid,
type cart_types DEFAULT 'default'::cart_types NOT NULL,
completed_at timestamp with time zone,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
deleted_at timestamp with time zone,
metadata jsonb,
idempotency_key character varying,
context jsonb,
payment_authorized_at timestamp with time zone,
sales_channel_id uuid
);
CREATE TABLE cart_discounts
(
cart_id uuid NOT NULL,
discount_id uuid NOT NULL
);
CREATE TABLE cart_gift_cards
(
cart_id uuid NOT NULL,
gift_card_id uuid NOT NULL
);