diff --git a/make/migrations/postgresql/0030_2.0.0_schema.up.sql b/make/migrations/postgresql/0030_2.0.0_schema.up.sql index 97ed28dc1..06a5889be 100644 --- a/make/migrations/postgresql/0030_2.0.0_schema.up.sql +++ b/make/migrations/postgresql/0030_2.0.0_schema.up.sql @@ -191,6 +191,9 @@ DROP TABLE IF EXISTS access_log; /*remove the constraint for project_id in table 'notification_policy'*/ ALTER TABLE notification_policy DROP CONSTRAINT unique_project_id; +/*the existing policy has no name, to make sure the unique constraint for name works, use the id as name*/ +/*if the name is set via API, it will be force to be changed with new pattern*/ +UPDATE notification_policy SET name=CONCAT('policy_', id); /*add the unique constraint for name in table 'notification_policy'*/ ALTER TABLE notification_policy ADD UNIQUE (name);