epic-games: migrateDb: rm .runs, .claimed[] -> .[user][game_id], closes #27

If you'd like to keep the .runs data: `cp -a data/epic-games.{json, v1.json}`
Objects also have insertion order for non-number strings, so there's not need for a list:
https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order
This commit is contained in:
Ralf Vogler 2022-10-06 14:53:07 +02:00
parent 61af4e35f6
commit ac758d39e4
2 changed files with 23 additions and 19 deletions

View file

@ -16,6 +16,7 @@ import { Low, JSONFile } from 'lowdb';
export const jsonDb = async file => {
const db = new Low(new JSONFile(dataDir(file)));
await db.read();
db.data ||= {};
return db;
};