fix: disallow duplicate folders

This commit is contained in:
divyam234 2024-06-15 11:09:05 +05:30
parent abcf81b204
commit d0d0f2f8ed

View file

@ -0,0 +1,7 @@
-- +goose Up
-- +goose StatementBegin
DROP INDEX IF EXISTS teldrive.unique_file;
CREATE UNIQUE INDEX IF NOT EXISTS unique_file ON teldrive.files USING btree (name, parent_id, user_id,size) WHERE (status = 'active'::text AND type='file'::text);
CREATE UNIQUE INDEX IF NOT EXISTS unique_folder ON teldrive.files USING btree (name, parent_id, user_id) WHERE (type='folder'::text);
-- +goose StatementEnd