feat: general improvements

This commit is contained in:
2024-11-30 16:01:33 +01:00
parent 8e7bfd2048
commit b248ee80ee
24 changed files with 870 additions and 705 deletions

View File

@@ -1,29 +0,0 @@
-- CreateTable
CREATE TABLE "users" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"age" INTEGER NOT NULL,
"persona" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "items" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"amount" DOUBLE PRECISION NOT NULL,
"datetime" TIMESTAMP(3) NOT NULL,
"location" TEXT NOT NULL,
"notes" TEXT,
"userId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "items_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "items" ADD CONSTRAINT "items_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "items" ADD COLUMN "reflections" JSONB;

View File

@@ -1,2 +0,0 @@
-- AlterTable
ALTER TABLE "items" ALTER COLUMN "reflections" SET DEFAULT null;

View File

@@ -1,3 +0,0 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"

View File

@@ -1,36 +0,0 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
name String
age Int
persona Json
items Item[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("users")
}
model Item {
id Int @id @default(autoincrement())
name String
amount Float
datetime DateTime
location String
notes String?
reflections Json? @default(dbgenerated("null"))
user User @relation(fields: [userId], references: [id])
userId Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("items")
}