Skip to content

Commit 8dd7569

Browse files
committed
feat(migrate): add database migration scripts for new tables
Introduces migrations for `DatasetType` and `MakeDataCountProcessState` tables. These include schema definitions, relationships, constraints, and an index to support new functionalities. The initial extra migrations were done when 6.2 was released, now adding the others.
1 parent 113f798 commit 8dd7569

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CREATE TABLE IF NOT EXISTS DatasetType
2+
(
3+
id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
4+
name VARCHAR(255) NOT NULL,
5+
CONSTRAINT pk_datasettype PRIMARY KEY (id)
6+
);
7+
8+
CREATE TABLE IF NOT EXISTS DatasetType_licenses
9+
(
10+
DatasetType_id BIGINT NOT NULL,
11+
licenses_id BIGINT NOT NULL
12+
);
13+
14+
CREATE TABLE IF NOT EXISTS DatasetType_metadataBlocks
15+
(
16+
DatasetType_id BIGINT NOT NULL,
17+
metadataBlocks_id BIGINT NOT NULL
18+
);
19+
20+
ALTER TABLE DatasetType
21+
ADD CONSTRAINT uc_828171b214f7369ee92a28781 UNIQUE (name);
22+
23+
ALTER TABLE DatasetType_licenses
24+
ADD CONSTRAINT fk_datlic_on_dataset_type FOREIGN KEY (DatasetType_id) REFERENCES DatasetType (id);
25+
26+
ALTER TABLE DatasetType_licenses
27+
ADD CONSTRAINT fk_datlic_on_license FOREIGN KEY (licenses_id) REFERENCES License (id);
28+
29+
ALTER TABLE DatasetType_metadataBlocks
30+
ADD CONSTRAINT fk_datmet_on_dataset_type FOREIGN KEY (DatasetType_id) REFERENCES DatasetType (id);
31+
32+
ALTER TABLE DatasetType_metadataBlocks
33+
ADD CONSTRAINT fk_datmet_on_metadata_block FOREIGN KEY (metadataBlocks_id) REFERENCES MetadataBlock (id);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE TABLE IF NOT EXISTS MakeDataCountProcessState
2+
(
3+
id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
4+
yearMonth VARCHAR(255) NOT NULL,
5+
state INTEGER NOT NULL,
6+
stateChangeTimestamp TIMESTAMP WITHOUT TIME ZONE,
7+
server VARCHAR(255),
8+
CONSTRAINT pk_makedatacountprocessstate PRIMARY KEY (id)
9+
);
10+
11+
CREATE INDEX IF NOT EXISTS idx_18d578c22760ad21e31cc873d ON MakeDataCountProcessState (yearMonth);

0 commit comments

Comments
 (0)