holiday-api/db/dev/v1_0.sql

57 lines
1.3 KiB
MySQL
Raw Normal View History

2023-08-05 19:34:09 +00:00
CREATE TABLE IF NOT EXISTS "country"
(
id uuid,
iso_name char(2) UNIQUE NOT NULL,
name varchar(45) NOT NULL,
primary key (id)
);
2023-06-20 14:10:46 +00:00
CREATE TABLE IF NOT EXISTS "holiday"
(
id uuid,
2023-08-05 19:34:09 +00:00
country char(2) NOT NULL,
date date NOT NULL,
name varchar(64) NOT NULL,
2023-06-20 14:10:46 +00:00
description varchar(512),
2023-08-05 19:34:09 +00:00
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
2023-06-20 14:10:46 +00:00
);
CREATE TABLE IF NOT EXISTS "webhook"
(
id uuid,
created timestamp NOT NULL,
url varchar(256) NOT NULL,
country char(2) NOT NULL,
retry_count int NOT NULL,
on_created bool NOT NULL,
on_edited bool NOT NULL,
on_deleted bool NOT NULL,
2023-06-20 14:10:46 +00:00
primary key (id),
constraint fk_country_id foreign key (country)
references country(iso_name) on delete cascade on update cascade
);
2023-06-20 14:10:46 +00:00
CREATE TABLE IF NOT EXISTS "job"
(
id uuid,
webhook_id uuid NOT NULL,
created timestamp NOT NULL,
success bool NOT NULL,
success_time timestamp,
2023-06-20 14:10:46 +00:00
retry_count int NOT NULL,
content varchar(1024) NOT NULL,
primary key (id),
constraint fk_webhook_id foreign key (webhook_id)
references webhook(id) on delete cascade on update cascade
);