From a0ac9a018317992d451a617c028a81b0ed470b39 Mon Sep 17 00:00:00 2001 From: Simon Nedjari Date: Mon, 9 Sep 2024 12:14:37 +0200 Subject: [PATCH] create migration for TeamComment table --- .../1725876544595-AddTeamCommentTable.ts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 server/migrations/1725876544595-AddTeamCommentTable.ts diff --git a/server/migrations/1725876544595-AddTeamCommentTable.ts b/server/migrations/1725876544595-AddTeamCommentTable.ts new file mode 100644 index 000000000..3e51c8a1e --- /dev/null +++ b/server/migrations/1725876544595-AddTeamCommentTable.ts @@ -0,0 +1,44 @@ +import type { MigrationInterface, QueryRunner } from 'typeorm'; +import { Table } from 'typeorm'; + +export class AddTeamCommentTable1725876544595 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.createTable( + new Table({ + name: 'team_comment', + columns: [ + { + name: 'id', + type: 'int', + isPrimary: true, + isGenerated: true, + generationStrategy: 'increment', + }, + { + name: 'comment', + type: 'text', + }, + { + name: 'createdAt', + type: 'timestamp', + default: 'CURRENT_TIMESTAMP', + }, + { + name: 'updatedAt', + type: 'timestamp', + default: 'CURRENT_TIMESTAMP', + onUpdate: 'CURRENT_TIMESTAMP', + }, + ], + }), + true, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + const tableExists = await queryRunner.hasTable('team_comment'); + if (tableExists) { + await queryRunner.dropTable('team_comment'); + } + } +}