add unique constraint

master
Aevann 2024-10-23 23:01:09 +03:00
parent f41c077d86
commit 1c34e1155c
1 changed files with 13 additions and 10 deletions

View File

@ -16,6 +16,9 @@ CREATE SEQUENCE public.media_usages_id_seq
NO MAXVALUE
CACHE 1;
ALTER TABLE ONLY public.media_usages
ADD CONSTRAINT media_usages_unique UNIQUE NULLS NOT DISTINCT (filename, post_id, comment_id);
ALTER SEQUENCE public.media_usages_id_seq OWNED BY public.media_usages.id;
ALTER TABLE ONLY public.media_usages ALTER COLUMN id SET DEFAULT nextval('public.media_usages_id_seq'::regclass);