2018-06-01 08:58:43 +02:00
|
|
|
\c notaryserver;
|
|
|
|
|
|
|
|
CREATE TABLE "tuf_files" (
|
Fix unable to use Notary after updating to v1.6.0
This commit is to fix the issue on notary migrations from mysql to pgsql.
1, alter sequence for the primary key of changeseed, this is missed in v1.6.0 migrator.
2, alter table owners from postgres to notarysigner and notaryserver.
Issue:
https://github.com/goharbor/harbor/issues/6465
Workaround:
https://github.com/goharbor/harbor/issues/6465#issuecomment-445162616
Impacted upgrade path:
1, Upgrade from version older then v1.6.0 with migrator:v1.6.0, and migrates the notarty DB.
No impacted upgrade path:
1, Upgrade from version older than v1.6.0 with migrator:v1.6.0, but without migrates the notarty DB.
Notes:
After merge this fix, we need to provide an new migrator with an new tag, like v1.6.1, and
deprecated the v1.6.0. For those who was impacted by migrator v1.6.0, will open an new PR to build
the workaround into the migrator and expose an specical command for hot-fix.
Signed-off-by: wang yan <wangyan@vmware.com>
2018-12-07 09:59:25 +01:00
|
|
|
"id" serial PRIMARY KEY,
|
2018-06-01 08:58:43 +02:00
|
|
|
"created_at" timestamp NULL DEFAULT NULL,
|
|
|
|
"updated_at" timestamp NULL DEFAULT NULL,
|
|
|
|
"deleted_at" timestamp NULL DEFAULT NULL,
|
|
|
|
"gun" varchar(255) NOT NULL,
|
|
|
|
"role" varchar(255) NOT NULL,
|
|
|
|
"version" integer NOT NULL,
|
|
|
|
"data" bytea NOT NULL,
|
|
|
|
"sha256" char(64) DEFAULT NULL,
|
|
|
|
UNIQUE ("gun","role","version")
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX tuf_files_sha256_idx ON tuf_files(sha256);
|
|
|
|
|
|
|
|
CREATE TABLE "change_category" (
|
|
|
|
"category" VARCHAR(20) PRIMARY KEY
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE "changefeed" (
|
|
|
|
"id" serial PRIMARY KEY,
|
|
|
|
"created_at" timestamp DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
"gun" varchar(255) NOT NULL,
|
|
|
|
"version" integer NOT NULL,
|
|
|
|
"sha256" CHAR(64) DEFAULT NULL,
|
|
|
|
"category" VARCHAR(20) NOT NULL DEFAULT 'update' REFERENCES "change_category"
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX "idx_changefeed_gun" ON "changefeed" ("gun");
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE "schema_migrations" (
|
|
|
|
"version" int PRIMARY KEY
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO server;
|