1
Fork 0

core: Use plural in table names

This commit is contained in:
Steffo 2024-11-15 02:05:49 +01:00
parent e65c85616d
commit c27af2cf53
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 21 additions and 21 deletions

View file

@ -19,7 +19,7 @@ CREATE TABLE meta_links (
CREATE TABLE meta_link_properties ( CREATE TABLE meta_link_properties (
id UUID DEFAULT gen_random_uuid(), id UUID DEFAULT gen_random_uuid(),
link UUID REFERENCES meta_link (id), link UUID REFERENCES meta_links (id),
rel BPCHAR NOT NULL, rel BPCHAR NOT NULL,
value BPCHAR, value BPCHAR,
@ -34,14 +34,14 @@ CREATE TABLE meta_properties (
PRIMARY KEY (id) PRIMARY KEY (id)
); );
CREATE FUNCTION get_meta_aliases(BPCHAR) RETURNS SETOF meta_alias AS $$ CREATE FUNCTION get_meta_aliases(BPCHAR) RETURNS SETOF meta_aliases AS $$
SELECT * FROM meta_aliases WHERE meta_aliases.pattern ILIKE $1; SELECT * FROM meta_aliases WHERE meta_aliases.pattern ILIKE $1;
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
CREATE FUNCTION get_meta_links(BPCHAR) RETURNS SETOF meta_link AS $$ CREATE FUNCTION get_meta_links(BPCHAR) RETURNS SETOF meta_links AS $$
SELECT * FROM meta_links WHERE meta_links.pattern ILIKE $1; SELECT * FROM meta_links WHERE meta_links.pattern ILIKE $1;
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
CREATE FUNCTION get_meta_property(BPCHAR) RETURNS SETOF meta_property AS $$ CREATE FUNCTION get_meta_properties(BPCHAR) RETURNS SETOF meta_properties AS $$
SELECT * FROM meta_properties WHERE meta_properties.pattern ILIKE $1; SELECT * FROM meta_properties WHERE meta_properties.pattern ILIKE $1;
$$ LANGUAGE SQL; $$ LANGUAGE SQL;

View file

@ -1,7 +1,7 @@
// @generated automatically by Diesel CLI. // @generated automatically by Diesel CLI.
diesel::table! { diesel::table! {
meta_alias (id) { meta_aliases (id) {
id -> Uuid, id -> Uuid,
pattern -> Bpchar, pattern -> Bpchar,
alias -> Bpchar, alias -> Bpchar,
@ -9,7 +9,16 @@ diesel::table! {
} }
diesel::table! { diesel::table! {
meta_link (id) { meta_link_properties (id) {
id -> Uuid,
link -> Nullable<Uuid>,
rel -> Bpchar,
value -> Nullable<Bpchar>,
}
}
diesel::table! {
meta_links (id) {
id -> Uuid, id -> Uuid,
pattern -> Bpchar, pattern -> Bpchar,
rel -> Bpchar, rel -> Bpchar,
@ -20,27 +29,18 @@ diesel::table! {
} }
diesel::table! { diesel::table! {
meta_link_property (id) { meta_properties (id) {
id -> Uuid,
link -> Nullable<Uuid>,
rel -> Bpchar,
value -> Nullable<Bpchar>,
}
}
diesel::table! {
meta_property (id) {
id -> Uuid, id -> Uuid,
pattern -> Bpchar, pattern -> Bpchar,
value -> Nullable<Bpchar>, value -> Nullable<Bpchar>,
} }
} }
diesel::joinable!(meta_link_property -> meta_link (link)); diesel::joinable!(meta_link_properties -> meta_links (link));
diesel::allow_tables_to_appear_in_same_query!( diesel::allow_tables_to_appear_in_same_query!(
meta_alias, meta_aliases,
meta_link, meta_link_properties,
meta_link_property, meta_links,
meta_property, meta_properties,
); );