Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(eventlist): cleanup of events just hides from widget (#4164)
* fix(eventlist): cleanup of events just hides from widget This will ensure we still keep all data for users Fixes #3653 * fix
- Loading branch information
Showing
5 changed files
with
65 additions
and
4 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/bot/database/migration/mysql/1601297968526-eventListIsHiddenAttr.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 eventListIsHiddenAttr1601297968526 implements MigrationInterface { | ||
name = 'eventListIsHiddenAttr1601297968526'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`event_list\` ADD \`isHidden\` tinyint NOT NULL DEFAULT 0`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE \`event_list\` DROP COLUMN \`isHidden\``, undefined); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/bot/database/migration/postgres/1601297968526-eventListIsHiddenAttr.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 eventListIsHiddenAttr1601297968526 implements MigrationInterface { | ||
name = 'eventListIsHiddenAttr1601297968526'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "event_list" ADD "isHidden" boolean NOT NULL DEFAULT false`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "event_list" DROP COLUMN "isHidden"`, undefined); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/bot/database/migration/sqlite/1601297968526-eventListIsHiddenAttr.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,24 @@ | ||
import {MigrationInterface, QueryRunner} from 'typeorm'; | ||
|
||
export class eventListIsHiddenAttr1601297968526 implements MigrationInterface { | ||
name = 'eventListIsHiddenAttr1601297968526'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_8a80a3cf6b2d815920a390968a"`); | ||
await queryRunner.query(`CREATE TABLE "temporary_event_list" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "event" varchar NOT NULL, "userId" varchar NOT NULL, "timestamp" bigint NOT NULL, "values_json" text NOT NULL, "isTest" boolean NOT NULL, "isHidden" boolean NOT NULL DEFAULT (0))`); | ||
await queryRunner.query(`INSERT INTO "temporary_event_list"("id", "event", "userId", "timestamp", "values_json", "isTest") SELECT "id", "event", "userId", "timestamp", "values_json", "isTest" FROM "event_list"`); | ||
await queryRunner.query(`DROP TABLE "event_list"`); | ||
await queryRunner.query(`ALTER TABLE "temporary_event_list" RENAME TO "event_list"`); | ||
await queryRunner.query(`CREATE INDEX "IDX_8a80a3cf6b2d815920a390968a" ON "event_list" ("userId") `); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "IDX_8a80a3cf6b2d815920a390968a"`); | ||
await queryRunner.query(`ALTER TABLE "event_list" RENAME TO "temporary_event_list"`); | ||
await queryRunner.query(`CREATE TABLE "event_list" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "event" varchar NOT NULL, "userId" varchar NOT NULL, "timestamp" bigint NOT NULL, "values_json" text NOT NULL, "isTest" boolean NOT NULL)`); | ||
await queryRunner.query(`INSERT INTO "event_list"("id", "event", "userId", "timestamp", "values_json", "isTest") SELECT "id", "event", "userId", "timestamp", "values_json", "isTest" FROM "temporary_event_list"`); | ||
await queryRunner.query(`DROP TABLE "temporary_event_list"`); | ||
await queryRunner.query(`CREATE INDEX "IDX_8a80a3cf6b2d815920a390968a" ON "event_list" ("userId") `); | ||
} | ||
|
||
} |
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