diff --git a/acrate-core/migrations/2024-11-14-031744_meta/up.sql b/acrate-core/migrations/2024-11-14-031744_meta/up.sql index cb663db..12a9fdf 100644 --- a/acrate-core/migrations/2024-11-14-031744_meta/up.sql +++ b/acrate-core/migrations/2024-11-14-031744_meta/up.sql @@ -19,7 +19,7 @@ CREATE TABLE meta_links ( CREATE TABLE meta_link_properties ( id UUID DEFAULT gen_random_uuid(), - link UUID REFERENCES meta_link (id), + link UUID REFERENCES meta_links (id), rel BPCHAR NOT NULL, value BPCHAR, @@ -34,14 +34,14 @@ CREATE TABLE meta_properties ( 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; $$ 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; $$ 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; $$ LANGUAGE SQL; diff --git a/acrate-core/src/schema.rs b/acrate-core/src/schema.rs index 913e83e..9f8c994 100644 --- a/acrate-core/src/schema.rs +++ b/acrate-core/src/schema.rs @@ -1,7 +1,7 @@ // @generated automatically by Diesel CLI. diesel::table! { - meta_alias (id) { + meta_aliases (id) { id -> Uuid, pattern -> Bpchar, alias -> Bpchar, @@ -9,7 +9,16 @@ diesel::table! { } diesel::table! { - meta_link (id) { + meta_link_properties (id) { + id -> Uuid, + link -> Nullable, + rel -> Bpchar, + value -> Nullable, + } +} + +diesel::table! { + meta_links (id) { id -> Uuid, pattern -> Bpchar, rel -> Bpchar, @@ -20,27 +29,18 @@ diesel::table! { } diesel::table! { - meta_link_property (id) { - id -> Uuid, - link -> Nullable, - rel -> Bpchar, - value -> Nullable, - } -} - -diesel::table! { - meta_property (id) { + meta_properties (id) { id -> Uuid, pattern -> Bpchar, value -> Nullable, } } -diesel::joinable!(meta_link_property -> meta_link (link)); +diesel::joinable!(meta_link_properties -> meta_links (link)); diesel::allow_tables_to_appear_in_same_query!( - meta_alias, - meta_link, - meta_link_property, - meta_property, + meta_aliases, + meta_link_properties, + meta_links, + meta_properties, );