Initialisation de la base données côté serveur

This commit is contained in:
2024-12-07 10:17:47 +01:00
parent d08dcb9720
commit ab180a12ce
9 changed files with 327 additions and 6 deletions

26
server/prisma/seed.ts Normal file
View 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();
});