✨ feat: create db seed for initialization
This commit is contained in:
25
prisma/seed/index.ts
Normal file
25
prisma/seed/index.ts
Normal 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();
|
||||
});
|
||||
Reference in New Issue
Block a user