Skip to content

Commit

Permalink
create migration for TeamComment table
Browse files Browse the repository at this point in the history
  • Loading branch information
SimNed committed Sep 9, 2024
1 parent 6e66556 commit a0ac9a0
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions server/migrations/1725876544595-AddTeamCommentTable.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
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<void> {
const tableExists = await queryRunner.hasTable('team_comment');
if (tableExists) {
await queryRunner.dropTable('team_comment');
}
}
}

0 comments on commit a0ac9a0

Please sign in to comment.