31 lines
775 B
TypeScript
31 lines
775 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
import * as bcrypt from 'bcrypt';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const password = await bcrypt.hash('password', 10);
|
|
const user = await prisma.user.upsert({
|
|
where: { email: 'admin@igcrm.com' },
|
|
update: {},
|
|
create: {
|
|
id: 'd9b0a1d0-1e1e-4b1e-8e1e-1e1e1e1e1e1e', // Fixed ID for admin
|
|
email: 'admin@igcrm.com',
|
|
name: 'Admin User',
|
|
password,
|
|
role: 'ADMIN',
|
|
updatedAt: new Date(),
|
|
},
|
|
});
|
|
console.log('User created:', user);
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|