From 6f1c46624ff66d44d9f4c7548e1175212ce58e1f Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Fri, 23 Mar 2018 17:45:50 +0800 Subject: [PATCH 1/2] Update SQL script to add uuid to job tables. We have to add the uuid/id mapping as new job service will only store uuid. Further work is in feature branch for now, commit this change to accelerate migration work. --- make/photon/db/registry.sql | 4 ++++ make/photon/db/registry_sqlite.sql | 4 ++++ tools/migration/db/changelog.md | 1 + 3 files changed, 9 insertions(+) diff --git a/make/photon/db/registry.sql b/make/photon/db/registry.sql index b59694c27..7ad545eb9 100644 --- a/make/photon/db/registry.sql +++ b/make/photon/db/registry.sql @@ -193,6 +193,8 @@ create table replication_job ( repository varchar(256) NOT NULL, operation varchar(64) NOT NULL, tags varchar(16384), + #New job service only records uuid, for compatibility in this table both IDs are stored. + job_uuid varchar(64), creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (id), @@ -217,6 +219,8 @@ create table img_scan_job ( repository varchar(256) NOT NULL, tag varchar(128) NOT NULL, digest varchar(128), + #New job service only records uuid, for compatibility in this table both IDs are stored. + job_uuid varchar(64), creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (id) diff --git a/make/photon/db/registry_sqlite.sql b/make/photon/db/registry_sqlite.sql index 40490a4f7..226dfbe09 100644 --- a/make/photon/db/registry_sqlite.sql +++ b/make/photon/db/registry_sqlite.sql @@ -183,6 +183,8 @@ create table replication_job ( repository varchar(256) NOT NULL, operation varchar(64) NOT NULL, tags varchar(16384), + #New job service only records uuid, for compatibility in this table both IDs are stored. + job_uuid varchar(64), creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP ); @@ -204,6 +206,8 @@ create table img_scan_job ( repository varchar(256) NOT NULL, tag varchar(128) NOT NULL, digest varchar(64), + #New job service only records uuid, for compatibility in this table both IDs are stored. + job_uuid varchar(64), creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP ); diff --git a/tools/migration/db/changelog.md b/tools/migration/db/changelog.md index 505f47c09..879b549c5 100644 --- a/tools/migration/db/changelog.md +++ b/tools/migration/db/changelog.md @@ -72,3 +72,4 @@ Changelog for harbor database schema - create table `harbor_resource_label` - 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` From df69f7e410182866c81902e140c83e25cdde11b5 Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Sun, 25 Mar 2018 13:47:03 +0800 Subject: [PATCH 2/2] Fix error in registry_sqlite.sql --- make/photon/db/registry_sqlite.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/make/photon/db/registry_sqlite.sql b/make/photon/db/registry_sqlite.sql index 226dfbe09..f506d89f2 100644 --- a/make/photon/db/registry_sqlite.sql +++ b/make/photon/db/registry_sqlite.sql @@ -183,7 +183,6 @@ create table replication_job ( repository varchar(256) NOT NULL, operation varchar(64) NOT NULL, tags varchar(16384), - #New job service only records uuid, for compatibility in this table both IDs are stored. job_uuid varchar(64), creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP @@ -206,7 +205,6 @@ create table img_scan_job ( repository varchar(256) NOT NULL, tag varchar(128) NOT NULL, digest varchar(64), - #New job service only records uuid, for compatibility in this table both IDs are stored. job_uuid varchar(64), creation_time timestamp default CURRENT_TIMESTAMP, update_time timestamp default CURRENT_TIMESTAMP