From 77bdd47c86e2fdddd81a4f7a07c6b15e74553ec2 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 22 Nov 2016 17:09:55 +0100 Subject: [PATCH] Fix images sql functions for properly return builtin collections. --- backend/resources/sql/images.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/resources/sql/images.sql b/backend/resources/sql/images.sql index 178ab68e3..2f2a71051 100644 --- a/backend/resources/sql/images.sql +++ b/backend/resources/sql/images.sql @@ -15,7 +15,8 @@ returning *; select *, (select count(*) from images where collection = ic.id) as num_images from images_collections as ic - where ic."user" = :user + where (ic."user" = :user or + uc."user" = '00000000-0000-0000-0000-000000000000'::uuid) and ic.deleted_at is null order by ic.created_at desc; @@ -27,7 +28,8 @@ update images_collections -- :name get-images-by-collection :? :* select * from images - where "user" = :user + where ("user" = :user or + "user" = '00000000-0000-0000-0000-000000000000'::uuid) and deleted_at is null and collection = :collection order by created_at desc;