Skip to content

Commit

Permalink
chore(be): update seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
krystxf committed Oct 28, 2024
1 parent c63e696 commit dd26817
Show file tree
Hide file tree
Showing 4 changed files with 319,383 additions and 171,016 deletions.
16 changes: 0 additions & 16 deletions apps/backend/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ type Platform = {
stopId: string;
};

type PlatformOnRoute = {
routeId: string;
platformId: string;
};

const parseSeedFile = <T>(path: string): T => {
const raw = fs.readFileSync(path).toString();

Expand All @@ -43,9 +38,6 @@ async function main() {
const platforms = parseSeedFile<Platform[]>(
"./prisma/seeds/platforms.json",
);
const platformsOnRoutes = parseSeedFile<PlatformOnRoute[]>(
"./prisma/seeds/platforms-on-routes.json",
);

await prisma.$transaction(async (transaction) => {
await transaction.platformsOnRoutes.deleteMany();
Expand Down Expand Up @@ -79,14 +71,6 @@ async function main() {
name: platform.name,
})),
});

await transaction.platformsOnRoutes.createMany({
data: platformsOnRoutes.map((platformOnRoute) => ({
platformId: platformOnRoute.platformId,
routeId: platformOnRoute.routeId,
})),
skipDuplicates: true,
});
});
}
main()
Expand Down
Loading

0 comments on commit dd26817

Please sign in to comment.