Add data model changes

This commit is contained in:
Lukas | AstroGD 2022-11-25 17:16:10 +01:00
parent 7a5d7f46b6
commit ca29f047e9
Signed by: AstroGD
GPG Key ID: 82A5E6C236C535AA
3 changed files with 23 additions and 0 deletions

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;