mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 10:51:36 +01:00
Add postgres sql file formatting via pg_format
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
-- migrate:up
|
||||
CREATE VIEW api.website_overview
|
||||
WITH (security_invoker = on)
|
||||
AS
|
||||
CREATE VIEW api.website_overview WITH ( security_invoker = ON
|
||||
) AS
|
||||
SELECT
|
||||
w.id,
|
||||
w.user_id,
|
||||
@@ -16,29 +15,28 @@ SELECT
|
||||
ho.main_content,
|
||||
f.additional_text,
|
||||
(
|
||||
SELECT json_agg(
|
||||
json_build_object(
|
||||
'title', a.title,
|
||||
'meta_description', a.meta_description,
|
||||
'meta_author', a.meta_author,
|
||||
'cover_image', a.cover_image,
|
||||
'publication_date', a.publication_date,
|
||||
'main_content', a.main_content
|
||||
)
|
||||
)
|
||||
FROM internal.article a
|
||||
WHERE a.website_id = w.id
|
||||
) AS articles
|
||||
FROM
|
||||
SELECT
|
||||
JSON_AGG(
|
||||
JSON_BUILD_OBJECT(
|
||||
'title', a.title, 'meta_description', a.meta_description, 'meta_author', a.meta_author, 'cover_image', a.cover_image, 'publication_date', a.publication_date, 'main_content', a.main_content
|
||||
)
|
||||
)
|
||||
FROM
|
||||
internal.article a
|
||||
WHERE
|
||||
a.website_id = w.id
|
||||
) AS articles
|
||||
FROM
|
||||
internal.website w
|
||||
JOIN internal.settings s ON w.id = s.website_id
|
||||
JOIN internal.header h ON w.id = h.website_id
|
||||
JOIN internal.home ho ON w.id = ho.website_id
|
||||
JOIN internal.footer f ON w.id = f.website_id;
|
||||
JOIN internal.settings s ON w.id = s.website_id
|
||||
JOIN internal.header h ON w.id = h.website_id
|
||||
JOIN internal.home ho ON w.id = ho.website_id
|
||||
JOIN internal.footer f ON w.id = f.website_id;
|
||||
|
||||
GRANT SELECT ON api.website_overview TO authenticated_user;
|
||||
|
||||
-- migrate:down
|
||||
REVOKE SELECT ON api.website_overview FROM authenticated_user;
|
||||
|
||||
DROP VIEW api.website_overview;
|
||||
DROP VIEW api.website_overview;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user