fix(migration): user query runner for broken entities recovery to avoid type issues

This commit is contained in:
Nicolas Meienberger 2022-08-17 07:31:55 +02:00
parent cf5797a13c
commit 9c2bcc2280
2 changed files with 9 additions and 4 deletions

View file

@ -80,6 +80,9 @@ services:
networks:
tipi_main_network:
driver: bridge
driver_opts:
com.docker.network.bridge.enable_ip_masquerade: "true"
com.docker.network.bridge.enable_icc: "true"
ipam:
driver: default
config:

View file

@ -6,9 +6,11 @@ import Update from '../../modules/system/update.entity';
const recover = async () => {
logger.info('Recovering broken database');
const apps = await App.find();
const users = await User.find();
const updated = await Update.find();
const queryRunner = datasource.createQueryRunner();
const apps = await queryRunner.query('SELECT * FROM app');
const users = await queryRunner.query('SELECT * FROM "user"');
const updates = await queryRunner.query('SELECT * FROM update');
// drop database
await datasource.dropDatabase();
@ -27,7 +29,7 @@ const recover = async () => {
}
// create updates
for (const update of updated) {
for (const update of updates) {
await Update.create(update).save();
}