Fix seed script

Delete Plus Ballots before deleting Users so that Postgres doesn't
complain about DB integrity.
This commit is contained in:
Kalle (Sendou)
2021-04-23 10:28:26 +03:00
parent bf1b7c5839
commit deb81c65b6

View File

@@ -1,13 +1,13 @@
import fs from "fs";
import path from "path";
import prisma from "./client";
import {
getPlusVotingSummaryData,
getPlusSuggestionsData,
getPlusStatusesData,
} from "./mocks/plus";
import userFactory from "./factories/user";
import calendarEventFactory from "./factories/calendarEvent";
import userFactory from "./factories/user";
import {
getPlusStatusesData,
getPlusSuggestionsData,
getPlusVotingSummaryData,
} from "./mocks/plus";
async function main() {
throwIfNotLocalhost();
@@ -52,6 +52,7 @@ async function dropAllData() {
await prisma.plusSuggestion.deleteMany({});
await prisma.plusStatus.deleteMany({});
await prisma.calendarEvent.deleteMany({});
await prisma.plusBallot.deleteMany({});
await prisma.user.deleteMany({});
}