16 lines
656 B
SQL
16 lines
656 B
SQL
-- Rodada 5, B9: a customer with an account keeps a built sheet (a cart item)
|
|
-- in Minhas folhas and asks for it again, edits it or deletes it later.
|
|
CREATE TABLE IF NOT EXISTS dtf_local.saved_sheets (
|
|
id uuid PRIMARY KEY,
|
|
account uuid NOT NULL REFERENCES dtf_local.accounts(id) ON DELETE CASCADE,
|
|
name text NOT NULL,
|
|
mode text NOT NULL CHECK (mode IN ('file','avulsa','uvfile','uv','premium')),
|
|
metres numeric NOT NULL,
|
|
item jsonb NOT NULL,
|
|
uploads uuid[] NOT NULL,
|
|
picture text,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
used_at timestamptz
|
|
);
|
|
CREATE INDEX IF NOT EXISTS saved_sheets_account ON dtf_local.saved_sheets(account);
|