2
0

fix(db): switch blockId and groupId on old answers

This commit is contained in:
Baptiste Arnaud
2022-07-13 08:17:33 +02:00
parent c2ff1ff68f
commit b62b955c07
4 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,12 @@
-- Update old answers
UPDATE "Answer" a
SET "blockId" = a."groupId",
"groupId" = a."blockId"
WHERE "createdAt" < '2022-06-10 22:00:00 UTC'
AND NOT EXISTS (
SELECT 1
FROM "Answer"
WHERE "resultId" = a."resultId"
AND "blockId" = a."groupId"
AND "groupId" = a."blockId"
);