From bfa0f32874df78fb34781b186ae5d54ca8f44131 Mon Sep 17 00:00:00 2001 From: Zack Fu Zi Xiang Date: Thu, 27 Jun 2024 18:55:06 +0800 Subject: [PATCH 1/2] fix: use two column as unique constraint --- migrations/20240627525836_publish_collab_5.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 migrations/20240627525836_publish_collab_5.sql diff --git a/migrations/20240627525836_publish_collab_5.sql b/migrations/20240627525836_publish_collab_5.sql new file mode 100644 index 00000000..7a475749 --- /dev/null +++ b/migrations/20240627525836_publish_collab_5.sql @@ -0,0 +1,7 @@ +-- Drop the existing unique constraint on publish_name +ALTER TABLE public.af_published_collab +DROP CONSTRAINT unique_publish_name; + +-- Add a new unique constraint for the combination of publish_name and view_id +ALTER TABLE public.af_published_collab +ADD CONSTRAINT unique_workspace_id_publish_name UNIQUE (workspace_id, publish_name); From f3d621de98b8feb351f2ea380c1ae0d9d96de23a Mon Sep 17 00:00:00 2001 From: Zack Date: Thu, 27 Jun 2024 19:03:29 +0800 Subject: [PATCH 2/2] fix: sqlx comments --- migrations/20240627525836_publish_collab_5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/20240627525836_publish_collab_5.sql b/migrations/20240627525836_publish_collab_5.sql index 7a475749..605ab2f3 100644 --- a/migrations/20240627525836_publish_collab_5.sql +++ b/migrations/20240627525836_publish_collab_5.sql @@ -2,6 +2,6 @@ ALTER TABLE public.af_published_collab DROP CONSTRAINT unique_publish_name; --- Add a new unique constraint for the combination of publish_name and view_id +-- Add a new unique constraint for the combination of publish_name and workspace_id ALTER TABLE public.af_published_collab ADD CONSTRAINT unique_workspace_id_publish_name UNIQUE (workspace_id, publish_name);