chatdesk-ui/storage_v1.19.1/migrations/tenant/0015-add-can-insert-object-...

12 lines
415 B
PL/PgSQL

CREATE OR REPLACE FUNCTION storage.can_insert_object(bucketid text, name text, owner uuid, metadata jsonb)
RETURNS VOID
LANGUAGE plpgsql
AS $$
BEGIN
INSERT INTO "storage"."objects" ("bucket_id", "name", "owner", "metadata") VALUES (bucketid, name, owner, metadata);
-- hack to rollback the successful insert
RAISE sqlstate 'PT200' using
message = 'ROLLBACK',
detail = 'rollback successful insert';
END
$$;