Added dynamic support for countries

This commit is contained in:
brajkovic committed 2023-08-05 21:34:09 +02:00
1 parent 381444a838
commit 47b9939ead
17 files changed
+296 -69

No files matched your search

+25 -5
View File
@@ -1,14 +1,34 @@
CREATE TABLE IF NOT EXISTS "country"
(
id uuid,
iso_name char(2) UNIQUE NOT NULL,
name varchar(45) NOT NULL,
primary key (id)
);
CREATE TABLE IF NOT EXISTS "holiday"
(
id uuid,
country char(2),
date date,
name varchar(64),
country char(2) NOT NULL,
date date NOT NULL,
name varchar(64) NOT NULL,
description varchar(512),
is_state boolean,
is_religious boolean
is_state boolean NOT NULL,
is_religious boolean NOT NULL,
primary key (id),
constraint fk_country_id foreign key (country)
references country(iso_name) on delete cascade on update cascade
);
INSERT INTO "country" (id, iso_name, name)
VALUES
('096ca6c4-5c04-47a4-0063-4b4cc6f6b671', 'HR', 'Croatia'),
('096ca6c4-5c04-47a4-0063-4b4cc6f6b672', 'US', 'USA'),
('096ca6c4-5c04-47a4-0063-4b4cc6f6b673', 'FR', 'France'),
('096ca6c4-5c04-47a4-0063-4b4cc6f6b674', 'GB', 'Great Britain');
INSERT INTO "holiday" (id, country, date, name, description, is_state, is_religious)
VALUES
('096ca6c4-5c04-47a4-b363-4b4cc6f6b671', 'HR', '2023-01-01', 'Nova godina', '', true, false),