23 lines
530 B
TypeScript
23 lines
530 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
import * as bcrypt from 'bcrypt';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const hash = await bcrypt.hash('wraith', 10);
|
|
await prisma.user.upsert({
|
|
where: { email: 'admin@wraith.local' },
|
|
update: {},
|
|
create: {
|
|
email: 'admin@wraith.local',
|
|
passwordHash: hash,
|
|
displayName: 'Admin',
|
|
},
|
|
});
|
|
console.log('Seed complete: admin@wraith.local / wraith');
|
|
}
|
|
|
|
main()
|
|
.catch(console.error)
|
|
.finally(() => prisma.$disconnect());
|