1
Fork 0
tirocinio-canali-steffo-acrate/acrate-core/migrations/2024-11-14-031744_meta/up.sql

64 lines
1.4 KiB
MySQL
Raw Normal View History

CREATE TABLE IF NOT EXISTS meta_subjects (
id UUID DEFAULT gen_random_uuid(),
document BPCHAR NOT NULL,
pattern BPCHAR NOT NULL,
2024-11-16 05:45:58 +00:00
redirect BPCHAR,
PRIMARY KEY (id)
);
2024-11-15 19:48:51 +00:00
CREATE TABLE IF NOT EXISTS meta_aliases (
id UUID DEFAULT gen_random_uuid(),
document BPCHAR NOT NULL,
pattern BPCHAR NOT NULL,
alias BPCHAR NOT NULL,
PRIMARY KEY (id)
);
2024-11-15 19:48:51 +00:00
CREATE TABLE IF NOT EXISTS meta_links (
id UUID DEFAULT gen_random_uuid(),
document BPCHAR NOT NULL,
pattern BPCHAR NOT NULL,
rel BPCHAR NOT NULL,
type BPCHAR,
href BPCHAR,
template BPCHAR,
CONSTRAINT either_href_or_template_not_null CHECK (
(href IS NOT NULL AND template IS NULL)
OR
(href IS NULL AND template IS NOT NULL)
),
PRIMARY KEY (id)
);
2024-11-15 19:48:51 +00:00
CREATE TABLE IF NOT EXISTS meta_link_properties (
id UUID DEFAULT gen_random_uuid(),
meta_link_id UUID REFERENCES meta_links (id) NOT NULL,
rel BPCHAR NOT NULL,
value BPCHAR,
PRIMARY KEY (id)
);
2024-11-15 19:48:51 +00:00
CREATE TABLE IF NOT EXISTS meta_properties (
id UUID DEFAULT gen_random_uuid(),
document BPCHAR NOT NULL,
pattern BPCHAR NOT NULL,
rel BPCHAR NOT NULL,
value BPCHAR,
PRIMARY KEY (id)
);
2024-11-15 19:48:51 +00:00
CREATE TABLE IF NOT EXISTS meta_link_titles (
id UUID DEFAULT gen_random_uuid(),
meta_link_id UUID REFERENCES meta_links (id) NOT NULL,
2024-11-15 19:48:51 +00:00
language BPCHAR NOT NULL DEFAULT 'und',
value BPCHAR NOT NULL,
2024-11-15 19:48:51 +00:00
CONSTRAINT unique_languages UNIQUE (meta_link_id, language),
PRIMARY KEY(id)
);