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;