Add Prisma integration with SQLite, update dependencies, and configure Svelte
This commit is contained in:
24
prisma/migrations/20251124201656_init/migration.sql
Normal file
24
prisma/migrations/20251124201656_init/migration.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "Year" (
|
||||
"year" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Person" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL,
|
||||
"yearId" INTEGER NOT NULL,
|
||||
CONSTRAINT "Person_yearId_fkey" FOREIGN KEY ("yearId") REFERENCES "Year" ("year") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Gift" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL,
|
||||
"url" TEXT,
|
||||
"description" TEXT,
|
||||
"price" REAL,
|
||||
"status" TEXT NOT NULL DEFAULT 'PLANNED',
|
||||
"personId" INTEGER NOT NULL,
|
||||
CONSTRAINT "Gift_personId_fkey" FOREIGN KEY ("personId") REFERENCES "Person" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "sqlite"
|
||||
46
prisma/schema.prisma
Normal file
46
prisma/schema.prisma
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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"
|
||||
}
|
||||
|
||||
model Year {
|
||||
year Int @id
|
||||
|
||||
people Person[]
|
||||
}
|
||||
|
||||
model Person {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
|
||||
yearId Int
|
||||
year Year @relation(fields: [yearId], references: [year])
|
||||
|
||||
gifts Gift[]
|
||||
}
|
||||
|
||||
model Gift {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
url String?
|
||||
description String?
|
||||
price Float?
|
||||
status GiftStatus @default(PLANNED)
|
||||
|
||||
personId Int
|
||||
person Person @relation(fields: [personId], references: [id])
|
||||
}
|
||||
|
||||
enum GiftStatus {
|
||||
PLANNED
|
||||
BUY
|
||||
BOUGHT
|
||||
WRAPPED
|
||||
GIVEN
|
||||
}
|
||||
Reference in New Issue
Block a user