diff --git a/package.json b/package.json index e79d89cf4..4e24e709e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "cy:run": "npx cypress run", "test:unit": "uvu -r tsm -r tsconfig-paths/register -i cypress", "tests": "npm run lint:styles && npm run lint:ts && npm run prettier:check && npm run typecheck && npm run test:unit", - "matches": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/matchesWithoutDetails.ts" + "matches": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/matchesWithoutDetails.ts", + "idify": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/idifyLfgMatchStages.ts" }, "dependencies": { "@dnd-kit/core": "^5.0.2", diff --git a/scripts/idifyLfgMatchStages.ts b/scripts/idifyLfgMatchStages.ts new file mode 100644 index 000000000..f60a5526c --- /dev/null +++ b/scripts/idifyLfgMatchStages.ts @@ -0,0 +1,36 @@ +import { PrismaClient } from "@prisma/client"; +import { v4 as uuidv4 } from "uuid"; + +const prisma = new PrismaClient(); + +async function main() { + const stages = await prisma.lfgGroupMatchStage.findMany({ + where: { + id: null, + }, + }); + + console.log("in total: ", stages.length); + let count = 1; + for (const stage of stages) { + await prisma.lfgGroupMatchStage.update({ + where: { + lfgGroupMatchId_order: { + lfgGroupMatchId: stage.lfgGroupMatchId, + order: stage.order, + }, + }, + data: { + id: uuidv4(), + }, + }); + + console.log(count); + count++; + } +} + +main() + // eslint-disable-next-line no-console + .then(() => console.log("done")) + .catch((e) => console.error(e));