Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE
- public.panel_settings (
- display_name text NOT NULL DEFAULT 'User'::text,
- terms text NULL DEFAULT '<ul><li>No refunds given</li></ul>'::text,
- id uuid NOT NULL DEFAULT gen_random_uuid (),
- discord text NULL DEFAULT ''::text,
- logo text NOT NULL DEFAULT '/default.svg'::text,
- avatar_url text NULL DEFAULT '/logo.svg'::text,
- created_at TIMESTAMP WITH TIME zone NULL DEFAULT now(),
- api_key uuid NULL DEFAULT gen_random_uuid (),
- api_uses_left SMALLINT NOT NULL DEFAULT '500'::SMALLINT,
- license_active BOOLEAN NOT NULL DEFAULT FALSE,
- subscription_id text NULL,
- CONSTRAINT panel_settings_pkey PRIMARY KEY (id),
- CONSTRAINT panel_settings_api_key_key UNIQUE (api_key),
- CONSTRAINT panel_settings_discord_check CHECK ((LENGTH(discord) < 30)),
- CONSTRAINT panel_settings_display_name_check CHECK ((LENGTH(display_name) < 100)),
- CONSTRAINT panel_settings_logo_check CHECK ((LENGTH(logo) < 500)),
- CONSTRAINT panel_settings_terms_check CHECK ((LENGTH(terms) < 500)),
- CONSTRAINT panel_settings_uses_left_check CHECK ((api_uses_left < 5000)),
- CONSTRAINT panel_settings_avatar_url_check CHECK ((LENGTH(avatar_url) < 1000))
- ) tablespace pg_default;
- CREATE TABLE
- public.panel_clients (
- id uuid NOT NULL DEFAULT gen_random_uuid (),
- created_at TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- username text NOT NULL DEFAULT ''::text,
- discord text NULL,
- email text NULL,
- avatar_url text NULL DEFAULT ''::text,
- panel_id uuid NOT NULL DEFAULT auth.uid (),
- password text NULL;
- CONSTRAINT panel_clients_pkey PRIMARY KEY (id),
- CONSTRAINT panel_clients_panel_id_fkey FOREIGN KEY (panel_id) REFERENCES panel_settings (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_clients_avatar_url_check CHECK ((LENGTH(avatar_url) < 10000)),
- CONSTRAINT panel_clients_discord_check CHECK ((LENGTH(discord) < 30)),
- CONSTRAINT panel_clients_email_check CHECK ((LENGTH(email) < 50)),
- CONSTRAINT panel_clients_username_check CHECK ((LENGTH(username) < 30))
- ) tablespace pg_default;
- CREATE TABLE
- public.notifications (
- id BIGINT generated BY DEFAULT AS IDENTITY,
- created_at TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- panel_id uuid NOT NULL DEFAULT auth.uid (),
- title text NULL DEFAULT 'New notification'::text,
- message text NULL,
- subject uuid NULL DEFAULT gen_random_uuid (),
- link text NOT NULL DEFAULT '/notifications'::text,
- READ BOOLEAN NULL DEFAULT FALSE,
- CONSTRAINT notifications_pkey PRIMARY KEY (id),
- CONSTRAINT public_notifications_panel_id_fkey FOREIGN KEY (panel_id) REFERENCES panel_settings (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT public_notifications_subject_fkey FOREIGN KEY (subject) REFERENCES panel_clients (id) ON UPDATE cascade ON DELETE cascade
- ) tablespace pg_default;
- CREATE TABLE
- public.products (
- id BIGINT generated BY DEFAULT AS IDENTITY,
- creator uuid NOT NULL DEFAULT auth.uid (),
- description text NULL DEFAULT ''::text,
- date_created TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- CONSTRAINT products_pkey PRIMARY KEY (id),
- CONSTRAINT products_creator_fkey FOREIGN KEY (creator) REFERENCES panel_settings (id) ON UPDATE cascade,
- CONSTRAINT products_description_check CHECK ((LENGTH(description) < 36))
- ) tablespace pg_default;
- CREATE TABLE
- public.panel_commissions (
- created_at TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- title text NULL DEFAULT 'New commission'::text,
- client uuid NULL,
- total_value NUMERIC NULL DEFAULT 0.00,
- total_paid NUMERIC NULL DEFAULT 0.00,
- start_date TIMESTAMP WITH TIME zone NULL DEFAULT now(),
- deadline TIMESTAMP WITH TIME zone NULL DEFAULT now(),
- STATUS text NOT NULL DEFAULT 'not_started'::text,
- id uuid NOT NULL DEFAULT gen_random_uuid (),
- panel_id uuid NOT NULL DEFAULT auth.uid (),
- tracking_id uuid NOT NULL DEFAULT gen_random_uuid (),
- product BIGINT NULL,
- pinned BOOLEAN NULL DEFAULT FALSE,
- notes text NULL,
- CONSTRAINT panel_commissions_pkey PRIMARY KEY (id),
- CONSTRAINT panel_commissions_tracking_id_key UNIQUE (tracking_id),
- CONSTRAINT panel_commissions_panel_id_fkey FOREIGN KEY (panel_id) REFERENCES panel_settings (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_commissions_client_fkey FOREIGN KEY (client) REFERENCES panel_clients (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_commissions_product_fkey FOREIGN KEY (product) REFERENCES products (id) ON UPDATE cascade ON DELETE RESTRICT,
- CONSTRAINT panel_commissions_notes_check CHECK ((LENGTH(notes) < 1500)),
- CONSTRAINT panel_commissions_status_check CHECK ((LENGTH(STATUS) < 20))
- ) tablespace pg_default;
- CREATE TABLE
- public.panel_quotes (
- created_at TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- title text NULL DEFAULT 'New quote'::text,
- client uuid NULL,
- proposed_amount INTEGER NULL DEFAULT 0,
- start_date TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- deadline TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- payment_terms text NOT NULL DEFAULT 'custom'::text,
- STATUS text NOT NULL DEFAULT 'pending'::text,
- id uuid NOT NULL DEFAULT gen_random_uuid (),
- panel_id uuid NOT NULL DEFAULT auth.uid (),
- CONSTRAINT panel_quotes_pkey PRIMARY KEY (id),
- CONSTRAINT panel_quotes_client_fkey FOREIGN KEY (client) REFERENCES panel_clients (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_quotes_panel_id_fkey FOREIGN KEY (panel_id) REFERENCES panel_settings (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_quotes_proposed_amount_check CHECK ((proposed_amount < 10000000))
- ) tablespace pg_default;
- CREATE TABLE
- public.panel_requests (
- created_at TIMESTAMP WITH TIME zone NOT NULL DEFAULT now(),
- description text NOT NULL,
- offered_amount NUMERIC NULL DEFAULT 0.00,
- deadline TIMESTAMP WITH TIME zone NULL,
- STATUS text NOT NULL DEFAULT 'requested'::text,
- id uuid NOT NULL DEFAULT gen_random_uuid (),
- panel_id uuid NOT NULL DEFAULT auth.uid (),
- commission uuid NULL,
- paid BOOLEAN NOT NULL DEFAULT FALSE,
- CONSTRAINT panel_requests_pkey PRIMARY KEY (id),
- CONSTRAINT panel_requests_commission_fkey FOREIGN KEY (commission) REFERENCES panel_commissions (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_requests_panel_id_fkey FOREIGN KEY (panel_id) REFERENCES panel_settings (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_requests_description_check CHECK ((LENGTH(description) > 0)),
- CONSTRAINT panel_requests_status_check CHECK ((LENGTH(STATUS) < 20))
- ) tablespace pg_default;
- CREATE TABLE
- public.panel_views (
- id BIGINT generated BY DEFAULT AS IDENTITY,
- DATA json NOT NULL,
- panel_id uuid NULL DEFAULT auth.uid (),
- name text NOT NULL DEFAULT 'New view'::text,
- CONSTRAINT panel_views_pkey PRIMARY KEY (id),
- CONSTRAINT panel_views_panel_id_fkey FOREIGN KEY (panel_id) REFERENCES panel_settings (id) ON UPDATE cascade ON DELETE cascade,
- CONSTRAINT panel_views_name_check CHECK ((LENGTH(name) < 30))
- ) tablespace pg_default;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement