Feature/4 add data delete on guild remove #7

Merged
AstroGD merged 7 commits from feature/4-add-data-delete-on-guild-remove into dev 2022-11-25 18:31:44 +01:00
3 changed files with 23 additions and 0 deletions
Showing only changes of commit ca29f047e9 - Show all commits

View File

@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class data1669392941776 implements MigrationInterface {
name = 'data1669392941776'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "guild_setting"
ADD "preserveDataOnGuildLeave" boolean NOT NULL DEFAULT false
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "guild_setting" DROP COLUMN "preserveDataOnGuildLeave"
`);
}
}

View File

@ -10,4 +10,7 @@ export class GuildSetting {
@Column("timestamp", { nullable: true, default: null })
isPremiumUntil!: Date | null;
@Column("boolean", { default: false })
preserveDataOnGuildLeave!: boolean
}

View File

@ -12,6 +12,7 @@ export async function getGuildSetting(guildID: string): Promise<GuildSetting> {
guildSetting.id = guildID;
guildSetting.isPremiumUntil = null;
guildSetting.notificationChannelID = null;
guildSetting.preserveDataOnGuildLeave = false;
}
return guildSetting;