core
: Update schema with more details
This commit is contained in:
parent
c36b6edbfb
commit
e5412d85ba
2 changed files with 30 additions and 2 deletions
|
@ -4,7 +4,6 @@ CREATE TABLE meta_aliases (
|
|||
pattern BPCHAR NOT NULL,
|
||||
alias BPCHAR NOT NULL,
|
||||
|
||||
CONSTRAINT unique_aliases UNIQUE (alias),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
@ -15,7 +14,13 @@ CREATE TABLE meta_links (
|
|||
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)
|
||||
);
|
||||
|
||||
|
@ -37,3 +42,13 @@ CREATE TABLE meta_properties (
|
|||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE 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',
|
||||
value BPCHAR NOT NULL,
|
||||
|
||||
CONSTRAINT unique_languages UNIQUE (meta_link_id, lang),
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
|
|
@ -18,14 +18,25 @@ diesel::table! {
|
|||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
meta_link_titles (id) {
|
||||
id -> Uuid,
|
||||
meta_link_id -> Uuid,
|
||||
lang -> Bpchar,
|
||||
value -> Bpchar,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
meta_links (id) {
|
||||
id -> Uuid,
|
||||
document -> Bpchar,
|
||||
pattern -> Bpchar,
|
||||
rel -> Bpchar,
|
||||
r#type -> Nullable<Bpchar>,
|
||||
#[sql_name = "type"]
|
||||
type_ -> Nullable<Bpchar>,
|
||||
href -> Nullable<Bpchar>,
|
||||
template -> Nullable<Bpchar>,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,10 +51,12 @@ diesel::table! {
|
|||
}
|
||||
|
||||
diesel::joinable!(meta_link_properties -> meta_links (meta_link_id));
|
||||
diesel::joinable!(meta_link_titles -> meta_links (meta_link_id));
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
meta_aliases,
|
||||
meta_link_properties,
|
||||
meta_link_titles,
|
||||
meta_links,
|
||||
meta_properties,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue