From 83cfe9814dfa6c850834a2c399d87c7906ec2b4e Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Wed, 21 Mar 2018 16:24:21 +0800 Subject: [PATCH] Add unique constraint to columns label_id, resource_id, resource_name and resource_type in table harbor_resource_label --- make/photon/db/registry.sql | 2 +- make/photon/db/registry_sqlite.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/make/photon/db/registry.sql b/make/photon/db/registry.sql index 111ca6232..b59694c27 100644 --- a/make/photon/db/registry.sql +++ b/make/photon/db/registry.sql @@ -287,7 +287,7 @@ create table harbor_resource_label ( creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY(id), - CONSTRAINT unique_label_resource UNIQUE (label_id,resource_id, resource_type) + CONSTRAINT unique_label_resource UNIQUE (label_id,resource_id, resource_name, resource_type) ); CREATE TABLE IF NOT EXISTS `alembic_version` ( diff --git a/make/photon/db/registry_sqlite.sql b/make/photon/db/registry_sqlite.sql index 82d0be64c..40490a4f7 100644 --- a/make/photon/db/registry_sqlite.sql +++ b/make/photon/db/registry_sqlite.sql @@ -281,7 +281,7 @@ create table harbor_resource_label ( resource_type char(1) NOT NULL, creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP, - UNIQUE (label_id,resource_id, resource_type) + UNIQUE (label_id,resource_id,resource_name,resource_type) ); create table alembic_version (