From 17d954f64782aceef485c34c1a80942553de1039 Mon Sep 17 00:00:00 2001 From: Mojmir Vinkler Date: Tue, 7 May 2024 18:17:56 +0200 Subject: [PATCH] :hammer: add migration to add chart_diff_approvals table (#3584) --- ...715081027513-AddChartDiffApprovalsTable.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 db/migration/1715081027513-AddChartDiffApprovalsTable.ts diff --git a/db/migration/1715081027513-AddChartDiffApprovalsTable.ts b/db/migration/1715081027513-AddChartDiffApprovalsTable.ts new file mode 100644 index 00000000000..8a2193361be --- /dev/null +++ b/db/migration/1715081027513-AddChartDiffApprovalsTable.ts @@ -0,0 +1,28 @@ +import { MigrationInterface, QueryRunner } from "typeorm" + +export class AddChartDiffApprovalsTable1715081027513 + implements MigrationInterface +{ + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`-- sql + CREATE TABLE chart_diff_approvals ( + id integer NOT NULL AUTO_INCREMENT, + chartId integer NOT NULL, + sourceUpdatedAt datetime NOT NULL, + targetUpdatedAt datetime DEFAULT NULL, + updatedAt datetime NOT NULL, + status varchar(255) NOT NULL, + + FOREIGN KEY (chartId) REFERENCES charts (id) ON DELETE CASCADE ON UPDATE CASCADE, + + PRIMARY KEY (id), + + INDEX (chartId) + ) + `) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE chart_diff_approvals`) + } +}