Initialisation de la base données côté serveur
This commit is contained in:
26
server/prisma/seed.ts
Normal file
26
server/prisma/seed.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const emmy = await prisma.user.upsert({
|
||||
where: { id: 1 },
|
||||
update: { name: 'Emmy' },
|
||||
create: { name: 'Emmy' },
|
||||
});
|
||||
const tamina = await prisma.user.upsert({
|
||||
where: { id: 2 },
|
||||
update: { name: 'Tamina' },
|
||||
create: { name: 'Tamina' },
|
||||
});
|
||||
console.log({ emmy, tamina });
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
Reference in New Issue
Block a user