chore: update project configuration by adding Prisma dependencies, generating Prisma client, and updating .gitignore; remove package-lock.json
This commit is contained in:
77
prisma/migrations/20251127115936_init/migration.sql
Normal file
77
prisma/migrations/20251127115936_init/migration.sql
Normal file
@@ -0,0 +1,77 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"email" TEXT NOT NULL,
|
||||
"name" TEXT,
|
||||
"password" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Session" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"title" TEXT NOT NULL,
|
||||
"collaborator" TEXT NOT NULL,
|
||||
"date" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"userId" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "SwotItem" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"content" TEXT NOT NULL,
|
||||
"category" TEXT NOT NULL,
|
||||
"order" INTEGER NOT NULL DEFAULT 0,
|
||||
"sessionId" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
CONSTRAINT "SwotItem_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "Session" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Action" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"title" TEXT NOT NULL,
|
||||
"description" TEXT,
|
||||
"priority" INTEGER NOT NULL DEFAULT 0,
|
||||
"status" TEXT NOT NULL DEFAULT 'todo',
|
||||
"dueDate" DATETIME,
|
||||
"sessionId" TEXT NOT NULL,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
CONSTRAINT "Action_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "Session" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ActionLink" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"actionId" TEXT NOT NULL,
|
||||
"swotItemId" TEXT NOT NULL,
|
||||
CONSTRAINT "ActionLink_actionId_fkey" FOREIGN KEY ("actionId") REFERENCES "Action" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT "ActionLink_swotItemId_fkey" FOREIGN KEY ("swotItemId") REFERENCES "SwotItem" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Session_userId_idx" ON "Session"("userId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "SwotItem_sessionId_idx" ON "SwotItem"("sessionId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Action_sessionId_idx" ON "Action"("sessionId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ActionLink_actionId_idx" ON "ActionLink"("actionId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ActionLink_swotItemId_idx" ON "ActionLink"("swotItemId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ActionLink_actionId_swotItemId_key" ON "ActionLink"("actionId", "swotItemId");
|
||||
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"
|
||||
84
prisma/schema.prisma
Normal file
84
prisma/schema.prisma
Normal file
@@ -0,0 +1,84 @@
|
||||
// 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 User {
|
||||
id String @id @default(cuid())
|
||||
email String @unique
|
||||
name String?
|
||||
password String
|
||||
sessions Session[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
collaborator String
|
||||
date DateTime @default(now())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
items SwotItem[]
|
||||
actions Action[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
enum SwotCategory {
|
||||
STRENGTH
|
||||
WEAKNESS
|
||||
OPPORTUNITY
|
||||
THREAT
|
||||
}
|
||||
|
||||
model SwotItem {
|
||||
id String @id @default(cuid())
|
||||
content String
|
||||
category SwotCategory
|
||||
order Int @default(0)
|
||||
sessionId String
|
||||
session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
actionLinks ActionLink[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([sessionId])
|
||||
}
|
||||
|
||||
model Action {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
description String?
|
||||
priority Int @default(0)
|
||||
status String @default("todo")
|
||||
dueDate DateTime?
|
||||
sessionId String
|
||||
session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
links ActionLink[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([sessionId])
|
||||
}
|
||||
|
||||
model ActionLink {
|
||||
id String @id @default(cuid())
|
||||
actionId String
|
||||
action Action @relation(fields: [actionId], references: [id], onDelete: Cascade)
|
||||
swotItemId String
|
||||
swotItem SwotItem @relation(fields: [swotItemId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([actionId, swotItemId])
|
||||
@@index([actionId])
|
||||
@@index([swotItemId])
|
||||
}
|
||||
Reference in New Issue
Block a user