From ca29f047e91e0ab338057e8246110eff3a8f2bd8 Mon Sep 17 00:00:00 2001 From: Lukas | AstroGD Date: Fri, 25 Nov 2022 17:16:10 +0100 Subject: [PATCH] Add data model changes --- src/data/migrations/1669392941776-data.ts | 19 +++++++++++++++++++ src/data/model/guildSetting.ts | 3 +++ src/tools/data.ts | 1 + 3 files changed, 23 insertions(+) create mode 100644 src/data/migrations/1669392941776-data.ts diff --git a/src/data/migrations/1669392941776-data.ts b/src/data/migrations/1669392941776-data.ts new file mode 100644 index 0000000..418aaf2 --- /dev/null +++ b/src/data/migrations/1669392941776-data.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class data1669392941776 implements MigrationInterface { + name = 'data1669392941776' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE "guild_setting" + ADD "preserveDataOnGuildLeave" boolean NOT NULL DEFAULT false + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE "guild_setting" DROP COLUMN "preserveDataOnGuildLeave" + `); + } + +} diff --git a/src/data/model/guildSetting.ts b/src/data/model/guildSetting.ts index 45c83ad..65c032c 100644 --- a/src/data/model/guildSetting.ts +++ b/src/data/model/guildSetting.ts @@ -10,4 +10,7 @@ export class GuildSetting { @Column("timestamp", { nullable: true, default: null }) isPremiumUntil!: Date | null; + + @Column("boolean", { default: false }) + preserveDataOnGuildLeave!: boolean } \ No newline at end of file diff --git a/src/tools/data.ts b/src/tools/data.ts index a12e1ee..0addaf6 100644 --- a/src/tools/data.ts +++ b/src/tools/data.ts @@ -12,6 +12,7 @@ export async function getGuildSetting(guildID: string): Promise { guildSetting.id = guildID; guildSetting.isPremiumUntil = null; guildSetting.notificationChannelID = null; + guildSetting.preserveDataOnGuildLeave = false; } return guildSetting;