import { MigrationInterface, QueryRunner, Table } from 'typeorm'; export class CreateCommentUsers1656312830147 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.createTable( new Table({ name: 'comment_users', columns: [ { name: 'id', type: 'uuid', isGenerated: true, default: 'gen_random_uuid()', isPrimary: true, }, { name: 'comment_id', type: 'uuid', isNullable: false, }, { name: 'user_id', type: 'uuid', isNullable: false, }, { name: 'is_read', type: 'boolean', default: false, isNullable: true, }, { name: 'created_at', type: 'timestamp', isNullable: true, default: 'now()', }, { name: 'updated_at', type: 'timestamp', isNullable: true, default: 'now()', }, ], foreignKeys: [ { referencedTableName: 'users', referencedColumnNames: ['id'], columnNames: ['user_id'], }, { referencedTableName: 'comments', referencedColumnNames: ['id'], columnNames: ['comment_id'], }, ], }), true ); } public async down(queryRunner: QueryRunner): Promise {} }