mirror of
https://github.com/docmost/docmost.git
synced 2025-11-14 03:51:12 +10:00
Replace space privacy with visibility
* Make creatorId nullable
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class RenameSpacePrivacyColumn1711051968957 implements MigrationInterface {
|
||||
name = 'RenameSpacePrivacyColumn1711051968957'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "spaces" RENAME COLUMN "privacy" TO "visibility"`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "spaces" RENAME COLUMN "visibility" TO "privacy"`);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class WorkspaceCreatorFK1711052439145 implements MigrationInterface {
|
||||
name = 'WorkspaceCreatorFK1711052439145'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "workspaces" ADD CONSTRAINT "UQ_2aab2dd12dc65eb183d99b953e0" UNIQUE ("creatorId")`);
|
||||
await queryRunner.query(`ALTER TABLE "workspaces" ADD CONSTRAINT "FK_2aab2dd12dc65eb183d99b953e0" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "workspaces" DROP CONSTRAINT "FK_2aab2dd12dc65eb183d99b953e0"`);
|
||||
await queryRunner.query(`ALTER TABLE "workspaces" DROP CONSTRAINT "UQ_2aab2dd12dc65eb183d99b953e0"`);
|
||||
await queryRunner.query(`ALTER TABLE "spaces" RENAME COLUMN "visibility" TO "privacy"`);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MakeSpaceCreatorIdNullable1711053025788 implements MigrationInterface {
|
||||
name = 'MakeSpaceCreatorIdNullable1711053025788'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "spaces" DROP CONSTRAINT "FK_8469f60fb94d43a0280a83d0b35"`);
|
||||
await queryRunner.query(`ALTER TABLE "spaces" ALTER COLUMN "creatorId" DROP NOT NULL`);
|
||||
await queryRunner.query(`ALTER TABLE "spaces" ADD CONSTRAINT "FK_8469f60fb94d43a0280a83d0b35" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "spaces" DROP CONSTRAINT "FK_8469f60fb94d43a0280a83d0b35"`);
|
||||
await queryRunner.query(`ALTER TABLE "spaces" ALTER COLUMN "creatorId" SET NOT NULL`);
|
||||
await queryRunner.query(`ALTER TABLE "spaces" ADD CONSTRAINT "FK_8469f60fb94d43a0280a83d0b35" FOREIGN KEY ("creatorId") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user