tierlist migration

This commit is contained in:
zkldi
2021-05-04 18:45:43 +01:00
parent 07f8cd99e1
commit e60aa08c1c
3 changed files with 47 additions and 5 deletions
@@ -0,0 +1,40 @@
import { TierlistParent, Game } from "kamaitachi-common";
import { gameHuman, validPlaytypes } from "kamaitachi-common/js/config";
import db from "../../src/db/db";
import MigrateRecords from "./migrate";
function ConvertFn(c: any): TierlistParent {
const tierlistParent: TierlistParent = {
createdAt: Date.now(),
tierlistID: c.tierlistID,
createdBy: 1,
description: `The official Kamaitachi Tierlist for ${gameHuman[c.game as Game]}${
validPlaytypes[c.game as Game].length > 1 ? ` (${c.playtype})` : ""
}.`,
game: c.game,
playtype: c.playtype,
isDefault: true,
name: c.title,
lastUpdated: Date.now(),
permissions: {
anyPlayer: {
edit: 0,
submit: 1,
vote: 1,
},
},
config: {
autoHumanise: false,
flags: ["Individual Difference"],
requireState: "clear",
},
};
return tierlistParent;
}
(async () => {
await MigrateRecords(db.tierlists, "tierlist", ConvertFn);
process.exit(0);
})();