diff --git a/package.json b/package.json index 912e8bc..db6e0b2 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "dependencies": { "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", - "@prisma/client": "^5.7.1", "@prisma/client": "5.7.1", "@remix-run/css-bundle": "^1.19.3", "@remix-run/node": "^1.19.3", @@ -18,7 +17,6 @@ "@remix-run/serve": "^1.19.3", "isbot": "^3.6.8", "mongodb": "^6.3.0", - "prisma": "^5.7.1", "prisma": "5.7.1", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c2a04f8..d784063 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -9,11 +9,10 @@ datasource db { model Champions { id String @id @default(auto()) @map("_id") @db.ObjectId - team String driver String driverCountry String copilot String copilotCountry String car String - year Int + year String } \ No newline at end of file diff --git a/prisma/script.ts b/prisma/script.ts new file mode 100644 index 0000000..68d5df4 --- /dev/null +++ b/prisma/script.ts @@ -0,0 +1,25 @@ +const { PrismaClient } = require('@prisma/client'); +const prisma = new PrismaClient(); + +async function main() { + const addChampion = await prisma.user.create({ + data: { + driver: "Sandro Munari", + driverCountry:"Italy", + copilot: "Pierro Sodano", + copilotCountry: "Italy", + car: "Fiat 131 Abarth", + year: "1977" + }, +}); + +console.log(`New champion added: ${addChampion.driver, addChampion.copilot}`, addChampion); +} + +main() + .catch(e => { + throw e + }) + .finally(async () => { + await prisma.$disconnect() + }); \ No newline at end of file