feat: create db seed for initialization

This commit is contained in:
Rafi Arrafif
2026-01-21 10:26:31 +07:00
parent 20b371dbf6
commit e33c0264fa
7 changed files with 97 additions and 1147 deletions

25
prisma/seed/index.ts Normal file
View File

@ -0,0 +1,25 @@
import { prisma } from "../../src/utils/databases/prisma/connection";
import { userRoleSeed } from "./userRole.seed";
import { userSystemSeed } from "./userSystem.seed";
async function main() {
console.log("🌱 Running all seeds...");
console.log("🔌 Connecting to database...");
const systemUserId = await userSystemSeed();
await userRoleSeed(systemUserId.id);
console.log("🌳 All seeds completed");
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
console.log(
"🔌 Disconnecting from database (this may take a few seconds)...",
);
await prisma.$disconnect();
});