feat: initial view queries

This commit is contained in:
Cory Dransfeldt 2024-10-12 13:07:26 -07:00
parent 8f44ce9bdd
commit 08e2c2ff3f
No known key found for this signature in database
23 changed files with 1282 additions and 10 deletions

19
views/globals/index.psql Normal file
View file

@ -0,0 +1,19 @@
CREATE OR REPLACE VIEW optimized_globals AS
SELECT
g.id,
g.site_name,
g.site_description,
g.author,
g.email,
g.mastodon,
g.url,
g.theme_color,
g.site_type,
g.locale,
g.lang,
CONCAT('/', df.filename_disk) AS avatar,
CONCAT('/', df2.filename_disk) AS avatar_transparent
FROM
globals g
LEFT JOIN directus_files df ON g.avatar = df.id
LEFT JOIN directus_files df2 ON g.avatar_transparent = df2.id