fix: seed script checks for any existing user, not just admin@wraith.local
Previously the seed only checked for admin@wraith.local by email, so it would create a duplicate if the admin had changed their email. Now skips seeding entirely if any user exists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2216ee79aa
commit
4ccf138744
@ -4,9 +4,9 @@ const bcrypt = require('bcrypt');
|
|||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const existing = await prisma.user.findUnique({ where: { email: 'admin@wraith.local' } });
|
const userCount = await prisma.user.count();
|
||||||
if (existing) {
|
if (userCount > 0) {
|
||||||
console.log('Seed: admin user already exists, skipping');
|
console.log('Seed: users already exist, skipping');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const hash = await bcrypt.hash('wraith', 10);
|
const hash = await bcrypt.hash('wraith', 10);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user