44 lines
1.9 KiB
Plaintext
44 lines
1.9 KiB
Plaintext
-- WARNING: This schema is for context only and is not meant to be run.
|
|
-- Table order and constraints may not be valid for execution.
|
|
|
|
CREATE TABLE public.Customers (
|
|
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
|
|
registered_at timestamp with time zone NOT NULL DEFAULT now(),
|
|
name character varying,
|
|
address character varying DEFAULT ''::character varying,
|
|
tier smallint DEFAULT '0'::smallint,
|
|
CONSTRAINT Customers_pkey PRIMARY KEY (id)
|
|
);
|
|
CREATE TABLE public.JobActions (
|
|
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
|
|
created_at timestamp with time zone NOT NULL DEFAULT now(),
|
|
action_type character varying NOT NULL,
|
|
part_type character varying,
|
|
part_id character varying,
|
|
custom_price bigint DEFAULT '-1'::bigint,
|
|
labour_fee bigint DEFAULT '0'::bigint,
|
|
service_record bigint,
|
|
CONSTRAINT JobActions_pkey PRIMARY KEY (id),
|
|
CONSTRAINT JobActions_service_record_fkey FOREIGN KEY (service_record) REFERENCES public.ServiceRecords(id)
|
|
);
|
|
CREATE TABLE public.ServiceRecords (
|
|
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
|
|
created_at timestamp with time zone NOT NULL DEFAULT now(),
|
|
vehicle character varying,
|
|
metadata character varying,
|
|
status smallint DEFAULT '0'::smallint,
|
|
CONSTRAINT ServiceRecords_pkey PRIMARY KEY (id),
|
|
CONSTRAINT ServiceRecords_vehicle_fkey FOREIGN KEY (vehicle) REFERENCES public.Vehicles(id)
|
|
);
|
|
CREATE TABLE public.Vehicles (
|
|
id character varying NOT NULL DEFAULT 'SDR-5000'::character varying,
|
|
registered_at timestamp with time zone NOT NULL DEFAULT now(),
|
|
make character varying DEFAULT 'tvs'::character varying,
|
|
model character varying DEFAULT 'rtr 200'::character varying,
|
|
capacity integer DEFAULT 200,
|
|
yom integer DEFAULT 2018,
|
|
metadata character varying,
|
|
owner bigint,
|
|
CONSTRAINT Vehicles_pkey PRIMARY KEY (id),
|
|
CONSTRAINT Vehicles_owner_fkey FOREIGN KEY (owner) REFERENCES public.Customers(id)
|
|
); |