Spaces:
Running
Running
File size: 1,895 Bytes
05f47b6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | -- 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.Cities (
id smallint GENERATED ALWAYS AS IDENTITY NOT NULL,
name character varying,
created_at timestamp with time zone NOT NULL DEFAULT now(),
CONSTRAINT Cities_pkey PRIMARY KEY (id)
);
CREATE TABLE public.Districts (
id integer GENERATED ALWAYS AS IDENTITY NOT NULL,
name character varying,
lname character varying,
city smallint,
created_at timestamp with time zone NOT NULL DEFAULT now(),
CONSTRAINT Districts_pkey PRIMARY KEY (id),
CONSTRAINT Districts_city_fkey FOREIGN KEY (city) REFERENCES public.Cities(id)
);
CREATE TABLE public.Positions (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
long real,
lat real,
type character varying,
speed json,
light smallint,
created_at timestamp with time zone NOT NULL DEFAULT now(),
CONSTRAINT Positions_pkey PRIMARY KEY (id)
);
CREATE TABLE public.StreetPosition (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
pos_id bigint,
street_id bigint,
created_at timestamp with time zone NOT NULL DEFAULT now(),
CONSTRAINT StreetPosition_pkey PRIMARY KEY (id)
);
CREATE TABLE public.Streets (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
name character varying,
type character varying,
district_id integer,
city_id smallint,
ban_id smallint,
parking_id smallint,
length smallint,
direction smallint,
speed smallint,
lane_1 character varying,
lane_2 character varying,
lane_n smallint,
toll smallint,
flooding smallint,
created_at timestamp with time zone NOT NULL DEFAULT now(),
CONSTRAINT Streets_pkey PRIMARY KEY (id),
CONSTRAINT Streets_city_id_fkey FOREIGN KEY (city_id) REFERENCES public.Cities(id),
CONSTRAINT Streets_district_id_fkey FOREIGN KEY (district_id) REFERENCES public.Districts(id)
); |