mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-25 23:47:17 +00:00
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
|
|
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||
|
|
|
||
|
|
export class CreateCommentUsers1656312830147 implements MigrationInterface {
|
||
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
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<void> {}
|
||
|
|
}
|