bazzar/migrations/20230603073530_shippings.sql

106 lines
4.3 KiB
MySQL
Raw Normal View History

2023-06-16 21:44:53 +02:00
--- DONE
--- DONE
--- DONE
2023-06-09 07:21:40 +02:00
CREATE TABLE tracking_links
(
id uuid NOT NULL,
url character varying,
tracking_number character varying NOT NULL,
fulfillment_id uuid NOT NULL,
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
);
CREATE TABLE custom_shipping_options
(
id uuid NOT NULL,
price integer NOT NULL,
shipping_option_id uuid NOT NULL,
cart_id uuid,
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
);
2023-06-09 17:30:58 +02:00
CREATE TABLE shipping_methods
(
id uuid NOT NULL,
shipping_option_id uuid NOT NULL,
order_id uuid,
cart_id uuid,
swap_id uuid,
return_id uuid,
price integer NOT NULL,
data jsonb NOT NULL,
claim_order_id uuid,
CONSTRAINT "CHK_64c6812fe7815be30d688df513" CHECK ((price >= 0)),
CONSTRAINT "CHK_a7020b08665bbd64d84a6641cf" CHECK (((claim_order_id IS NOT NULL) OR (order_id IS NOT NULL) OR
(cart_id IS NOT NULL) OR (swap_id IS NOT NULL) OR
(return_id IS NOT NULL)))
);
CREATE TABLE shipping_method_tax_lines
(
id uuid NOT NULL,
rate real NOT NULL,
name character varying NOT NULL,
code character varying,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
metadata jsonb,
shipping_method_id uuid NOT NULL
);
CREATE TABLE shipping_options
(
id uuid NOT NULL,
name character varying NOT NULL,
region_id uuid NOT NULL,
profile_id uuid NOT NULL,
provider_id uuid NOT NULL,
price_type shipping_option_price_types NOT NULL,
amount integer,
is_return boolean DEFAULT false NOT NULL,
data jsonb NOT NULL,
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,
admin_only boolean DEFAULT false NOT NULL,
CONSTRAINT "CHK_7a367f5901ae0a5b0df75aee38" CHECK ((amount >= 0))
);
CREATE TABLE shipping_option_requirements
(
id uuid NOT NULL,
shipping_option_id uuid NOT NULL,
type shipping_option_requirement_types NOT NULL,
amount integer NOT NULL,
deleted_at timestamp with time zone
);
CREATE TABLE shipping_profiles
(
id uuid NOT NULL,
name character varying NOT NULL,
type shipping_profile_types NOT NULL,
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
);
CREATE TABLE shipping_tax_rates
(
shipping_option_id uuid NOT NULL,
rate_id uuid NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
metadata jsonb
);