fix(f6.9): include every field photo and preserve document revisions
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 3m8s
DH V2 CI / WEB · typecheck, build (push) Successful in 19s
DH V2 CI / API · typecheck, tests, build (push) Successful in 32s
Production dependency audit / API · production dependencies (push) Successful in 8s
Production dependency audit / WEB · production dependencies (push) Successful in 9s
DH V2 CI / Docker / scripts contract (push) Successful in 59s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 3m8s
DH V2 CI / WEB · typecheck, build (push) Successful in 19s
DH V2 CI / API · typecheck, tests, build (push) Successful in 32s
Production dependency audit / API · production dependencies (push) Successful in 8s
Production dependency audit / WEB · production dependencies (push) Successful in 9s
DH V2 CI / Docker / scripts contract (push) Successful in 59s
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class F69ConsolidatedDocumentRevisions1790135400000 implements MigrationInterface {
|
||||
name = 'F69ConsolidatedDocumentRevisions1790135400000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE inspection_act_consolidated_pdf_revisions (
|
||||
act_id uuid NOT NULL REFERENCES inspection_acts(id) ON DELETE CASCADE,
|
||||
template_version smallint NOT NULL CHECK (template_version >= 1),
|
||||
stored_name varchar(255) NOT NULL,
|
||||
original_name varchar(255) NOT NULL,
|
||||
size_bytes integer NOT NULL CHECK (size_bytes > 0),
|
||||
sha256 char(64) NOT NULL CHECK (sha256 ~ '^[0-9a-f]{64}$'),
|
||||
generated_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (act_id,template_version)
|
||||
)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
INSERT INTO inspection_act_consolidated_pdf_revisions(
|
||||
act_id,template_version,stored_name,original_name,size_bytes,sha256,generated_at)
|
||||
SELECT act_id,1,stored_name,original_name,size_bytes,sha256,generated_at
|
||||
FROM inspection_act_consolidated_pdf_artifacts
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE inspection_report_consolidated_word_revisions (
|
||||
report_id uuid NOT NULL REFERENCES inspection_reports(id) ON DELETE CASCADE,
|
||||
template_version smallint NOT NULL CHECK (template_version >= 1),
|
||||
stored_name varchar(255) NOT NULL,
|
||||
original_name varchar(255) NOT NULL,
|
||||
size_bytes integer NOT NULL CHECK (size_bytes > 0),
|
||||
sha256 char(64) NOT NULL CHECK (sha256 ~ '^[0-9a-f]{64}$'),
|
||||
generated_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (report_id,template_version)
|
||||
)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
INSERT INTO inspection_report_consolidated_word_revisions(
|
||||
report_id,template_version,stored_name,original_name,size_bytes,sha256,generated_at)
|
||||
SELECT report_id,1,stored_name,original_name,size_bytes,sha256,generated_at
|
||||
FROM inspection_report_consolidated_word_artifacts
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query('DROP TABLE inspection_report_consolidated_word_revisions');
|
||||
await queryRunner.query('DROP TABLE inspection_act_consolidated_pdf_revisions');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user