Add unique constraint to columns label_id, resource_id, resource_name and resource_type in table harbor_resource_label

This commit is contained in:
Wenkai Yin 2018-03-21 16:24:21 +08:00
parent 838b439560
commit 83cfe9814d
2 changed files with 2 additions and 2 deletions

View File

@ -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` (

View File

@ -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 (