2022-02-14 14:29:32 +00:00
|
|
|
DROP VIEW IF EXISTS gists_gists_view;
|
|
|
|
CREATE VIEW gists_gists_view AS
|
|
|
|
SELECT
|
|
|
|
gists.description,
|
|
|
|
gists.created,
|
|
|
|
gists.updated,
|
|
|
|
gists.public_id,
|
|
|
|
gists_users.username as owner,
|
2022-02-14 15:08:19 +00:00
|
|
|
gists_visibility.name as visibility
|
2022-02-14 14:29:32 +00:00
|
|
|
FROM gists_gists gists
|
2022-02-14 15:08:19 +00:00
|
|
|
INNER JOIN gists_visibility ON gists_visibility.ID = gists.visibility
|
2022-02-14 14:29:32 +00:00
|
|
|
INNER JOIN gists_users ON gists_users.ID = gists.owner_id;
|
|
|
|
|
|
|
|
|
|
|
|
DROP VIEW IF EXISTS gists_comments_view;
|
|
|
|
CREATE VIEW gists_comments_view AS
|
|
|
|
SELECT
|
|
|
|
gists_comments.ID,
|
|
|
|
gists_comments.comment,
|
|
|
|
gists_comments.created,
|
|
|
|
gists_gists.public_id as gist_public_id,
|
|
|
|
gists_gists.ID as gist_id,
|
|
|
|
gists_users.username as owner
|
|
|
|
FROM gists_comments gists_comments
|
|
|
|
INNER JOIN gists_users ON gists_users.ID = gists_comments.owner_id
|
|
|
|
INNER JOIN gists_gists ON gists_gists.ID = gists_comments.gist_id;
|