Install dependencies:
npm install prisma @prisma/client
npx prisma init
Define schema in prisma/schema.prisma
:
model Deity {
id String @id @default(uuid())
name String
prayers Prayer[]
stories Story[]
images Image[]
occasions OccasionDeity[]
}
model Prayer {
id String @id @default(uuid())
name String
content String @db.Text
type String
translation String? @db.Text
audioUrl String?
deityId String
deity Deity @relation(fields: [deityId], references: [id])
occasions OccasionPrayer[]
}
// Additional models for Story, Image, Occasion, etc.
Create API endpoints in SvelteKit using server routes
Install Firebase:
npm install firebase
Set up Firebase config
Create Firestore collections
src/routes/api/
Which option would you prefer to proceed with?
After updating db in schema.prisma we should do
npx prisma migrate dev --create-only
This will first check if all the changes are correct then if all is well then ask yes /no and name of migration
then do
prisma migrate dev
then
npx prisma generate
to regenerate the prisma client.
then
npx prisma studio
to check the database