2019-12-04 09:55:41 +01:00
|
|
|
/* TODO remove the table artifact_2 and use the artifact instead after finishing the upgrade work */
|
|
|
|
CREATE TABLE artifact_2
|
|
|
|
(
|
|
|
|
id SERIAL PRIMARY KEY NOT NULL,
|
|
|
|
/* image, chart, etc */
|
2019-12-13 01:49:45 +01:00
|
|
|
type varchar(255) NOT NULL,
|
|
|
|
media_type varchar(255) NOT NULL,
|
2020-01-20 05:58:52 +01:00
|
|
|
manifest_media_type varchar(255) NOT NULL,
|
2019-12-04 09:55:41 +01:00
|
|
|
project_id int NOT NULL,
|
|
|
|
repository_id int NOT NULL,
|
|
|
|
digest varchar(255) NOT NULL,
|
|
|
|
size bigint,
|
|
|
|
push_time timestamp default CURRENT_TIMESTAMP,
|
2019-12-13 01:49:45 +01:00
|
|
|
pull_time timestamp,
|
2019-12-04 09:55:41 +01:00
|
|
|
extra_attrs text,
|
|
|
|
annotations jsonb,
|
|
|
|
CONSTRAINT unique_artifact_2 UNIQUE (repository_id, digest)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE tag
|
|
|
|
(
|
|
|
|
id SERIAL PRIMARY KEY NOT NULL,
|
|
|
|
repository_id int NOT NULL,
|
|
|
|
artifact_id int NOT NULL,
|
2019-12-13 01:49:45 +01:00
|
|
|
name varchar(255) NOT NULL,
|
2019-12-04 09:55:41 +01:00
|
|
|
push_time timestamp default CURRENT_TIMESTAMP,
|
|
|
|
pull_time timestamp,
|
2020-01-20 05:58:52 +01:00
|
|
|
/* TODO replace artifact_2 after finishing the upgrade work */
|
|
|
|
FOREIGN KEY (artifact_id) REFERENCES artifact_2(id),
|
2019-12-04 09:55:41 +01:00
|
|
|
CONSTRAINT unique_tag UNIQUE (repository_id, name)
|
|
|
|
);
|
|
|
|
|
|
|
|
/* artifact_reference records the child artifact referenced by parent artifact */
|
|
|
|
CREATE TABLE artifact_reference
|
|
|
|
(
|
2019-12-13 01:49:45 +01:00
|
|
|
id SERIAL PRIMARY KEY NOT NULL,
|
2019-12-04 09:55:41 +01:00
|
|
|
parent_id int NOT NULL,
|
2019-12-13 01:49:45 +01:00
|
|
|
child_id int NOT NULL,
|
|
|
|
platform varchar(255),
|
2020-01-20 05:58:52 +01:00
|
|
|
/* TODO replace artifact_2 after finishing the upgrade work */
|
|
|
|
FOREIGN KEY (parent_id) REFERENCES artifact_2(id),
|
|
|
|
FOREIGN KEY (child_id) REFERENCES artifact_2(id),
|
2019-12-13 01:49:45 +01:00
|
|
|
CONSTRAINT unique_reference UNIQUE (parent_id, child_id)
|
2019-12-04 09:55:41 +01:00
|
|
|
);
|