Following tutorial to set up remix app

This commit is contained in:
2024-04-26 20:22:03 +02:00
parent a68339f3db
commit 6877c045c3
25 changed files with 12874 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Beer {
id String @id @default(uuid())
name String @unique
abv Float
}
+35
View File
@@ -0,0 +1,35 @@
import { PrismaClient } from "@prisma/client";
const db = new PrismaClient();
async function seed() {
await Promise.all(
getBeers().map((beer) => {
return db.beer.create({ data: beer });
})
);
}
seed();
function getBeers() {
// shout-out to https://icanhazdadjoke.com/
return [
{
name: "Ginger Paradise",
abv: 6.2
},
{
name: "Hertog Jan Pilsener",
abv: 5.1
},
{
name: "Hertog Jan Weizener",
abv: 5.7
},
{
name: "Leffe Blond 0,0%",
abv: 0.0
}
];
}