mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-25 15:37:37 +00:00
19 lines
723 B
TypeScript
19 lines
723 B
TypeScript
|
|
import { DataBaseConstraints } from 'src/helpers/db_constraints.constants';
|
||
|
|
import { MigrationInterface, QueryRunner, TableUnique } from 'typeorm';
|
||
|
|
|
||
|
|
export class addUniqueKeyConstrainForOrganizationUsers1693309526388 implements MigrationInterface {
|
||
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.createUniqueConstraint(
|
||
|
|
'organization_users',
|
||
|
|
new TableUnique({
|
||
|
|
name: DataBaseConstraints.USER_ORGANIZATION_UNIQUE,
|
||
|
|
columnNames: ['user_id', 'organization_id'],
|
||
|
|
})
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.dropUniqueConstraint('organization_users', DataBaseConstraints.USER_ORGANIZATION_UNIQUE);
|
||
|
|
}
|
||
|
|
}
|