mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
check if table exists and has items before running migration
This commit is contained in:
parent
5908544602
commit
622107a6f1
@ -7,6 +7,16 @@ import { In, MigrationInterface, QueryRunner, Table } from "typeorm";
|
|||||||
|
|
||||||
export class FixRepackUploadDate1715900413313 implements MigrationInterface {
|
export class FixRepackUploadDate1715900413313 implements MigrationInterface {
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
const existsTable = await queryRunner.query(
|
||||||
|
`SELECT name FROM sqlite_master WHERE type='table' AND name='repack';`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!existsTable.length) return;
|
||||||
|
|
||||||
|
const repackCount = await queryRunner.manager.count(Repack);
|
||||||
|
|
||||||
|
if (!repackCount) return;
|
||||||
|
|
||||||
await queryRunner.createTable(
|
await queryRunner.createTable(
|
||||||
new Table({
|
new Table({
|
||||||
name: "repack_temp",
|
name: "repack_temp",
|
||||||
|
Loading…
Reference in New Issue
Block a user