mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-11 11:35:28 +01:00
6d800cabbd
This commit is to enable data migrator to support migrates data from mysql to pgsql, this is a specific step for user to upgrade harbor across v1.5.0, as we have move harbor DB to pgsql from 1.5.0. It supports both harbor and notary db data migration, and be split into two steps with dependency. It also fix issue #4847, add build DB migrator in make process.
39 lines
1013 B
PL/PgSQL
39 lines
1013 B
PL/PgSQL
\c notaryserver;
|
|
|
|
CREATE TABLE "tuf_files" (
|
|
"id" int PRIMARY KEY,
|
|
"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; |