Use polymorphic table for space membership

This commit is contained in:
Philipinho
2024-03-22 00:40:13 +00:00
parent 639842182c
commit 51baf30f0d
25 changed files with 471 additions and 452 deletions

View File

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class SpaceMemberEntityConstraint1711059108729 implements MigrationInterface {
name = 'SpaceMemberEntityConstraint1711059108729'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "space_members" ADD CONSTRAINT "CHK_allow_userId_or_groupId" CHECK (("userId" IS NOT NULL AND "groupId" IS NULL) OR ("userId" IS NULL AND "groupId" IS NOT NULL))`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "space_members" DROP CONSTRAINT "CHK_allow_userId_or_groupId"`);
}
}