1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-12-07 23:23:49 +02:00

improving date structure update handling

This commit is contained in:
Patrik J. Braun
2018-11-18 22:56:05 +01:00
parent 7a322e2afa
commit 16c3a755ee
3 changed files with 15 additions and 3 deletions

View File

@@ -13,11 +13,11 @@ import {VersionEntity} from './enitites/VersionEntity';
import {Logger} from '../../Logger';
import {MediaEntity} from './enitites/MediaEntity';
import {VideoEntity} from './enitites/VideoEntity';
import {DataStructureVersion} from '../../../common/DataStructureVersion';
export class SQLConnection {
private static VERSION = 2;
constructor() {
}
@@ -92,14 +92,14 @@ export class SQLConnection {
version = await connection.getRepository(VersionEntity).findOne();
} catch (ex) {
}
if (version && version.version === SQLConnection.VERSION) {
if (version && version.version === DataStructureVersion) {
return;
}
Logger.info('Updating database scheme');
if (!version) {
version = new VersionEntity();
}
version.version = SQLConnection.VERSION;
version.version = DataStructureVersion;
await connection.dropDatabase();