-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdc4150
commit a90b3f0
Showing
53 changed files
with
792 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class Moderator1689787853666 implements MigrationInterface { | ||
name = 'Moderator1689787853666' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "moderator_id" character varying`); | ||
await queryRunner.query(`CREATE INDEX "IDX_7127e358f4f0bf8686d77af14c" ON "sessions" ("moderator_id") `); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_7127e358f4f0bf8686d77af14cd" FOREIGN KEY ("moderator_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
await queryRunner.query(`UPDATE "sessions" SET "moderator_id" = "created_by_id"`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_7127e358f4f0bf8686d77af14cd"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_7127e358f4f0bf8686d77af14c"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "moderator_id"`); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
backend/src/db/migrations/1689787951867-ModeratorNonNull.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class ModeratorNonNull1689787951867 implements MigrationInterface { | ||
name = 'ModeratorNonNull1689787951867' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_1ccf045da14e5350b26ee882592"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ALTER COLUMN "created_by_id" DROP NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_1ccf045da14e5350b26ee882592" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_1ccf045da14e5350b26ee882592"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ALTER COLUMN "created_by_id" SET NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_1ccf045da14e5350b26ee882592" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
backend/src/db/migrations/1695539888278-RenameModerator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class RenameModerator1695539888278 implements MigrationInterface { | ||
name = 'RenameModerator1695539888278' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_title_edit_to_moderator" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_reordering_to_moderator" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_grouping_to_moderator" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_title_edit_to_moderator" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_reordering_to_moderator" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_grouping_to_moderator" boolean NOT NULL DEFAULT false`); | ||
|
||
await queryRunner.query(`UPDATE "templates" SET | ||
options_restrict_title_edit_to_moderator = options_restrict_title_edit_to_owner, | ||
options_restrict_reordering_to_moderator = options_restrict_reordering_to_owner, | ||
options_restrict_grouping_to_moderator = options_restrict_grouping_to_owner | ||
`); | ||
await queryRunner.query(`UPDATE "sessions" SET | ||
options_restrict_title_edit_to_moderator = options_restrict_title_edit_to_owner, | ||
options_restrict_reordering_to_moderator = options_restrict_reordering_to_owner, | ||
options_restrict_grouping_to_moderator = options_restrict_grouping_to_owner | ||
`); | ||
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_title_edit_to_owner"`); | ||
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_reordering_to_owner"`); | ||
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_grouping_to_owner"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_title_edit_to_owner"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_reordering_to_owner"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_grouping_to_owner"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_1ccf045da14e5350b26ee882592"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ALTER COLUMN "created_by_id" SET NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_1ccf045da14e5350b26ee882592" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_1ccf045da14e5350b26ee882592"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ALTER COLUMN "created_by_id" DROP NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_1ccf045da14e5350b26ee882592" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_grouping_to_owner" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_reordering_to_owner" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD "options_restrict_title_edit_to_owner" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_grouping_to_owner" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_reordering_to_owner" boolean NOT NULL DEFAULT false`); | ||
await queryRunner.query(`ALTER TABLE "templates" ADD "options_restrict_title_edit_to_owner" boolean NOT NULL DEFAULT false`); | ||
|
||
await queryRunner.query(`UPDATE "templates" SET | ||
options_restrict_title_edit_to_owner = options_restrict_title_edit_to_moderator, | ||
options_restrict_reordering_to_owner = options_restrict_reordering_to_moderator, | ||
options_restrict_grouping_to_owner = options_restrict_grouping_to_moderator | ||
`); | ||
await queryRunner.query(`UPDATE "sessions" SET | ||
options_restrict_title_edit_to_owner = options_restrict_title_edit_to_moderator, | ||
options_restrict_reordering_to_owner = options_restrict_reordering_to_moderator, | ||
options_restrict_grouping_to_owner = options_restrict_grouping_to_moderator | ||
`); | ||
|
||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_grouping_to_moderator"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_reordering_to_moderator"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP COLUMN "options_restrict_title_edit_to_moderator"`); | ||
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_grouping_to_moderator"`); | ||
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_reordering_to_moderator"`); | ||
await queryRunner.query(`ALTER TABLE "templates" DROP COLUMN "options_restrict_title_edit_to_moderator"`); | ||
|
||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
backend/src/db/migrations/1695540515122-ModeratorNonNull.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class ModeratorNonNull1695540515122 implements MigrationInterface { | ||
name = 'ModeratorNonNull1695540515122' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_7127e358f4f0bf8686d77af14cd"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ALTER COLUMN "moderator_id" SET NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_7127e358f4f0bf8686d77af14cd" FOREIGN KEY ("moderator_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "sessions" DROP CONSTRAINT "FK_7127e358f4f0bf8686d77af14cd"`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ALTER COLUMN "moderator_id" DROP NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "sessions" ADD CONSTRAINT "FK_7127e358f4f0bf8686d77af14cd" FOREIGN KEY ("moderator_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.