core
: Further schema improvements
This commit is contained in:
parent
d1dcbc1fc6
commit
f2d73c1798
3 changed files with 9 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
DROP TABLE IF EXISTS meta_properties CASCADE;
|
||||
DROP TABLE IF EXISTS meta_link_properties CASCADE;
|
||||
DROP TABLE IF EXISTS meta_link_titles CASCADE;
|
||||
DROP TABLE IF EXISTS meta_links CASCADE;
|
||||
DROP TABLE IF EXISTS meta_aliases CASCADE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CREATE TABLE meta_aliases (
|
||||
CREATE TABLE IF NOT EXISTS meta_aliases (
|
||||
id UUID DEFAULT gen_random_uuid(),
|
||||
document BPCHAR NOT NULL,
|
||||
pattern BPCHAR NOT NULL,
|
||||
|
@ -7,7 +7,7 @@ CREATE TABLE meta_aliases (
|
|||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE meta_links (
|
||||
CREATE TABLE IF NOT EXISTS meta_links (
|
||||
id UUID DEFAULT gen_random_uuid(),
|
||||
document BPCHAR NOT NULL,
|
||||
pattern BPCHAR NOT NULL,
|
||||
|
@ -24,7 +24,7 @@ CREATE TABLE meta_links (
|
|||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE meta_link_properties (
|
||||
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,
|
||||
|
@ -33,7 +33,7 @@ CREATE TABLE meta_link_properties (
|
|||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE meta_properties (
|
||||
CREATE TABLE IF NOT EXISTS meta_properties (
|
||||
id UUID DEFAULT gen_random_uuid(),
|
||||
document BPCHAR NOT NULL,
|
||||
pattern BPCHAR NOT NULL,
|
||||
|
@ -43,12 +43,12 @@ CREATE TABLE meta_properties (
|
|||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE meta_link_titles (
|
||||
CREATE TABLE IF NOT EXISTS meta_link_titles (
|
||||
id UUID DEFAULT gen_random_uuid(),
|
||||
meta_link_id UUID REFERENCES meta_links (id) NOT NULL,
|
||||
lang BPCHAR NOT NULL DEFAULT 'und',
|
||||
language BPCHAR NOT NULL DEFAULT 'und',
|
||||
value BPCHAR NOT NULL,
|
||||
|
||||
CONSTRAINT unique_languages UNIQUE (meta_link_id, lang),
|
||||
CONSTRAINT unique_languages UNIQUE (meta_link_id, language),
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ diesel::table! {
|
|||
meta_link_titles (id) {
|
||||
id -> Uuid,
|
||||
meta_link_id -> Uuid,
|
||||
lang -> Bpchar,
|
||||
language -> Bpchar,
|
||||
value -> Bpchar,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue