improved backup restore

This commit is contained in:
Julian Krauser 2025-01-31 13:58:07 +01:00
parent 0f621ac46d
commit ee60f497fa
4 changed files with 109 additions and 34 deletions

View file

@ -7,7 +7,11 @@ export class BackupAndResetDatabase1738166124200 implements MigrationInterface {
name = "BackupAndResetDatabase1738166124200";
public async up(queryRunner: QueryRunner): Promise<void> {
if ((await queryRunner.hasTable("user")) && !(await queryRunner.hasTable("salutation"))) {
let migrations = await queryRunner.query("SELECT `name` FROM `migrations`");
if (
(await queryRunner.hasTable("user")) &&
migrations.findIndex((m: any) => m.name == "MoveSendNewsletterFlag1737816852011") == -1
) {
throw new InternalException(
"Cannot update due to skiped version. Update to v1.2.2 Version first to prevent data loss and get access to the newer Versions."
);