Add indexes to job tables and bump up schema version.

This commit is contained in:
Tan Jiang 2018-03-28 14:02:53 +08:00
parent a12c213cd1
commit b6df6cf169
4 changed files with 12 additions and 5 deletions

View File

@ -199,7 +199,8 @@ create table replication_job (
update_time timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (id),
INDEX policy (policy_id),
INDEX poid_uptime (policy_id, update_time)
INDEX poid_uptime (policy_id, update_time),
INDEX poid_status (policy_id, status)
);
create table replication_immediate_trigger (
@ -223,7 +224,11 @@ create table img_scan_job (
job_uuid varchar(64),
creation_time timestamp default CURRENT_TIMESTAMP,
update_time timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (id)
PRIMARY KEY (id),
INDEX idx_status (status),
INDEX idx_digest (digest),
INDEX idx_uuid (job_uuid),
INDEX idx_repository_tag (repository,tag)
);
create table img_scan_overview (
@ -298,4 +303,4 @@ CREATE TABLE IF NOT EXISTS `alembic_version` (
`version_num` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into alembic_version values ('1.4.0');
insert into alembic_version values ('1.5.0');

View File

@ -290,5 +290,5 @@ create table alembic_version (
version_num varchar(32) NOT NULL
);
insert into alembic_version values ('1.4.0');
insert into alembic_version values ('1.5.0');

View File

@ -20,7 +20,7 @@ import (
const (
// SchemaVersion is the version of database schema
SchemaVersion = "1.4.0"
SchemaVersion = "1.5.0"
)
// GetSchemaVersion return the version of database schema

View File

@ -73,3 +73,5 @@ Changelog for harbor database schema
- create table `user_group`
- modify table `project_member` use `id` as PK and add column `entity_type` to indicate if the member is user or group.
- add `job_uuid` column to `replication_job` and `img_scan_job`
- add index `poid_status` in table replication_job
- add index `idx_status`, `idx_status`, `idx_digest`, `idx_repository_tag` in table img_scan_job