[MAJOR][FIRST] COMPLETE
This commit is contained in:
52
prisma/migrations/20251002164348_init/migration.sql
Normal file
52
prisma/migrations/20251002164348_init/migration.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `Board` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Task` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `TaskList` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "public"."Board" DROP CONSTRAINT "Board_userId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "public"."Task" DROP CONSTRAINT "Task_boardId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "public"."Task" DROP CONSTRAINT "Task_taskListId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "public"."TaskList" DROP CONSTRAINT "TaskList_boardId_fkey";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "public"."Board";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "public"."Task";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "public"."TaskList";
|
||||
|
||||
-- DropEnum
|
||||
DROP TYPE "public"."Status";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."Image" (
|
||||
"id" TEXT NOT NULL,
|
||||
"filename" TEXT NOT NULL,
|
||||
"s3Key" TEXT NOT NULL,
|
||||
"s3Url" TEXT NOT NULL,
|
||||
"status" TEXT NOT NULL,
|
||||
"mime" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"metaUrl" TEXT NOT NULL,
|
||||
"createdBy" TEXT NOT NULL,
|
||||
"updatedBy" TEXT NOT NULL,
|
||||
"secure" BOOLEAN NOT NULL DEFAULT false,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"hash" TEXT,
|
||||
"userId" TEXT,
|
||||
|
||||
CONSTRAINT "Image_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
24
prisma/migrations/20251002192847_indexing/migration.sql
Normal file
24
prisma/migrations/20251002192847_indexing/migration.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[s3Key]` on the table `Image` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[s3ThumbKey]` on the table `Image` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `s3ThumbKey` to the `Image` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `s3ThumbUrl` to the `Image` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "public"."Image" ADD COLUMN "s3ThumbKey" TEXT NOT NULL,
|
||||
ADD COLUMN "s3ThumbUrl" TEXT NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Image_s3Key_key" ON "public"."Image"("s3Key");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Image_s3ThumbKey_key" ON "public"."Image"("s3ThumbKey");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Image_filename_idx" ON "public"."Image"("filename");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Image_status_idx" ON "public"."Image"("status");
|
||||
@@ -1,12 +1,6 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
@@ -15,56 +9,39 @@ datasource db {
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
email String @unique
|
||||
pwdHash String?
|
||||
role UserRole @default(Standard)
|
||||
boards Board[]
|
||||
}
|
||||
|
||||
model Board {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
name String
|
||||
description String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
tasks Task[]
|
||||
taskLists TaskList[]
|
||||
model Image {
|
||||
id String @id @default(uuid())
|
||||
filename String
|
||||
s3Key String @unique
|
||||
s3Url String
|
||||
s3ThumbKey String @unique
|
||||
s3ThumbUrl String
|
||||
status String
|
||||
mime String
|
||||
type String // e.g., "image"
|
||||
metaUrl String
|
||||
createdBy String
|
||||
updatedBy String
|
||||
secure Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
hash String?
|
||||
userId String?
|
||||
// Add more fields as needed (e.g., thumbnail, metadata)
|
||||
|
||||
@@index([filename])
|
||||
@@index([status])
|
||||
}
|
||||
|
||||
model TaskList {
|
||||
id Int @id @default(autoincrement())
|
||||
boardId Int
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
board Board @relation(fields: [boardId], references: [id])
|
||||
tasks Task[]
|
||||
}
|
||||
|
||||
model Task {
|
||||
id Int @id @default(autoincrement())
|
||||
boardId Int
|
||||
taskListId Int?
|
||||
title String
|
||||
description String?
|
||||
status Status @default(todo)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
board Board @relation(fields: [boardId], references: [id])
|
||||
taskList TaskList? @relation(fields: [taskListId], references: [id])
|
||||
}
|
||||
|
||||
enum UserRole {
|
||||
Standard
|
||||
Admin
|
||||
}
|
||||
|
||||
enum Status {
|
||||
todo
|
||||
in_progress
|
||||
done
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user