Basic users and cities api

This commit is contained in:
Eden Kirin
2023-09-14 17:44:02 +02:00
parent c70169004d
commit 4875837d4e
20 changed files with 815 additions and 0 deletions

View File

@ -0,0 +1,26 @@
CREATE TABLE cities
(
id uuid DEFAULT gen_random_uuid() NOT NULL,
name varchar(50) NOT NULL,
postal_code varchar(10),
created_at timestamp WITH TIME ZONE DEFAULT NOW() NOT NULL,
modified_at timestamp WITH TIME ZONE DEFAULT NOW() NOT NULL
);
CREATE UNIQUE INDEX cities_id_uindex
ON cities (id);
CREATE TABLE users
(
id uuid DEFAULT gen_random_uuid() NOT NULL,
first_name varchar(50),
last_name varchar(50),
city_id uuid
CONSTRAINT users_cities_id_fk
REFERENCES cities (),
created_at timestamp WITH TIME ZONE DEFAULT NOW() NOT NULL,
modified_at timestamp WITH TIME ZONE DEFAULT NOW() NOT NULL
);
CREATE UNIQUE INDEX users_id_uindex
ON users (id);