Skip to content

Commit 8e70482

Browse files
Seed Kent user password (#672)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 2cb5747 commit 8e70482

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

prisma/seed.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3'
22
import { subMonths } from 'date-fns'
33
import { PrismaClient } from '#app/utils/prisma-generated.server/client.ts'
4+
import { getPasswordHash } from '#app/utils/password.server.ts'
45

56
import 'dotenv/config'
67

@@ -13,14 +14,24 @@ const prisma = new PrismaClient({
1314
})
1415

1516
async function main() {
17+
const kentPasswordHash = await getPasswordHash('iliketwix')
18+
1619
const kent = await prisma.user.upsert({
1720
where: { email: 'me@kentcdodds.com' },
18-
update: {},
21+
update: {
22+
password: {
23+
upsert: {
24+
create: { hash: kentPasswordHash },
25+
update: { hash: kentPasswordHash },
26+
},
27+
},
28+
},
1929
create: {
2030
email: `me@kentcdodds.com`,
2131
firstName: 'Kent',
2232
team: 'BLUE',
2333
role: 'ADMIN',
34+
password: { create: { hash: kentPasswordHash } },
2435
},
2536
})
2637

0 commit comments

Comments
 (0)