bazzar/migrations/20230603073520_customers.sql

32 lines
1.1 KiB
SQL

CREATE TABLE customers
(
id uuid NOT NULL,
email character varying NOT NULL,
first_name character varying,
last_name character varying,
billing_address_id uuid,
password_hash character varying,
phone character varying,
has_account boolean DEFAULT false 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 customer_groups
(
id uuid NOT NULL,
name character varying 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 customer_group_customers
(
customer_group_id uuid NOT NULL,
customer_id uuid NOT NULL
);