-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(customcommands): add randomizing of responses (#5644)
- Loading branch information
Showing
5 changed files
with
61 additions
and
10 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
14 changes: 14 additions & 0 deletions
14
src/database/migration/mysql/16.0.x/1678892044029-addRandomResponsesToggle.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,14 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class addRandomResponsesToggle1675089806900 implements MigrationInterface { | ||
name = 'addRandomResponsesToggle1675089806900'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`commands\` ADD \`areResponsesRandomized\` tinyint NOT NULL DEFAULT 0`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
return; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/database/migration/postgres/16.0.x/1678892044029-addRandomResponsesToggle.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,14 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class addRandomResponsesToggle1675089806900 implements MigrationInterface { | ||
name = 'addRandomResponsesToggle1675089806900'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "commands" ADD "areResponsesRandomized" boolean NOT NULL DEFAULT false`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
return; | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/database/migration/sqlite/16.0.x/1678892044029-addRandomResponsesToggle.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,19 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class addRandomResponsesToggle1675089806900 implements MigrationInterface { | ||
name = 'addRandomResponsesToggle1675089806900'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_1a8c40f0a581447776c325cb4f"`); | ||
await queryRunner.query(`CREATE TABLE "temporary_commands" ("id" varchar PRIMARY KEY NOT NULL, "command" varchar NOT NULL, "enabled" boolean NOT NULL, "visible" boolean NOT NULL, "group" varchar, "responses" text NOT NULL, "areResponsesRandomized" boolean NOT NULL DEFAULT (0))`); | ||
await queryRunner.query(`INSERT INTO "temporary_commands"("id", "command", "enabled", "visible", "group", "responses") SELECT "id", "command", "enabled", "visible", "group", "responses" FROM "commands"`); | ||
await queryRunner.query(`DROP TABLE "commands"`); | ||
await queryRunner.query(`ALTER TABLE "temporary_commands" RENAME TO "commands"`); | ||
await queryRunner.query(`CREATE INDEX "IDX_1a8c40f0a581447776c325cb4f" ON "commands" ("command") `); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
return; | ||
} | ||
|
||
} |
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