mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
18 lines
720 B
TypeScript
18 lines
720 B
TypeScript
import { DataBaseConstraints } from '@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);
|
|
}
|
|
}
|