summaryrefslogtreecommitdiff
path: root/server/database/migrations/1641570023672-AddContextIdToUserRole.ts
blob: 921c6793eba40fec3a98f7de3d6b0175e3e11782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';

export class AddContextIdToUserRole1641570023672 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.addColumn(
      'user_role',
      new TableColumn({
        name: 'contextId',
        type: 'text',
        default: "'root'", // default values must include single quotes for text
      }),
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.dropColumn('user_role', 'contextId');
  }
}