Add partial impl for icons collections importer (wip).

This commit is contained in:
Andrey Antukh 2016-11-20 23:25:48 +01:00
parent 6d0737e4a3
commit cf1188ad47
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
2 changed files with 87 additions and 5 deletions

View file

@ -15,14 +15,38 @@ delete from images
where id = :id
and "user" = '00000000-0000-0000-0000-000000000000'::uuid;
-- :name create-image-collection
-- :name create-images-collection
insert into images_collections (id, "user", name)
values (:id, '00000000-0000-0000-0000-000000000000'::uuid, :name)
on conflict (id)
do update set name = :name
returning *;
-- :name create-icons-collection
insert into icons_collections (id, "user", name)
values (:id, '00000000-0000-0000-0000-000000000000'::uuid, :name)
on conflict (id)
do update set name = :name
returning *;
-- :name get-image
select * from images as i
where i.id = :id
and i."user" = '00000000-0000-0000-0000-000000000000'::uuid;
-- :name get-icon
select * from icons as i
where i.id = :id
and i."user" = '00000000-0000-0000-0000-000000000000'::uuid;
-- :name create-icon :<! :1
insert into icons ("user", name, collection, metadata, content)
values (:user, :name, :collection, :metadata, :content)
on conflict (id)
do update set name = :name,
content = :content,
metadata = :metadata,
collection = :collection
"user" = '00000000-0000-0000-0000-000000000000'::uuid
returning *;