feat: Add new migration for SchemaMigrations

This commit adds a new migration file, MigrationName1720024126646, to the SchemaMigrations directory. This migration will be used to make changes to the database schema.
This commit is contained in:
Simon Larsen
2024-07-03 17:35:24 +01:00
parent 94c50b980a
commit 88dc64f182
3 changed files with 22 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1720024126646 implements MigrationInterface {
public name = "MigrationName1720024126646";
public async up(queryRunner: QueryRunner): Promise<void> {
// change type of secretValue from varchar to text
await queryRunner.query(
`ALTER TABLE "MonitorSecret" ALTER COLUMN "secretValue" TYPE text`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "MonitorSecret" ALTER COLUMN "secretValue" TYPE character varying(500)`,
);
}
}

View File

@@ -23,6 +23,7 @@ import { MigrationName1719827175832 } from "./1719827175832-MigrationName";
import { MigrationName1719831213463 } from "./1719831213463-MigrationName";
import { MigrationName1719838746775 } from "./1719838746775-MigrationName";
import { MigrationName1719915433542 } from "./1719915433542-MigrationName";
import { MigrationName1720024126646 } from "./1720024126646-MigrationName";
export default [
InitialMigration,
@@ -50,4 +51,5 @@ export default [
MigrationName1719831213463,
MigrationName1719838746775,
MigrationName1719915433542,
MigrationName1720024126646,
];

View File

@@ -227,7 +227,7 @@ export default class MonitorSecret extends BaseModel {
})
@TableColumn({
required: false,
type: TableColumnType.LongText,
type: TableColumnType.VeryLongText,
encrypted: true,
title: "Secret Value",
description:
@@ -235,8 +235,7 @@ export default class MonitorSecret extends BaseModel {
})
@Column({
nullable: true,
type: ColumnType.LongText,
length: ColumnLength.LongText,
type: ColumnType.VeryLongText,
})
public secretValue?: string = undefined;