basic functionality done

This commit is contained in:
Smigz 2025-06-08 11:12:26 -04:00
parent 1c5e2d1055
commit 269d7784ab
19 changed files with 5917 additions and 4677 deletions

View file

@ -0,0 +1,8 @@
-- AlterTable
ALTER TABLE "File" ADD COLUMN "uuid" UUID NOT NULL DEFAULT gen_random_uuid();
-- AlterTable
ALTER TABLE "Folder" ADD COLUMN "uuid" UUID NOT NULL DEFAULT gen_random_uuid();
-- AlterTable
ALTER TABLE "User" ADD COLUMN "uuid" UUID NOT NULL DEFAULT gen_random_uuid();

View file

@ -0,0 +1,58 @@
/*
Warnings:
- The primary key for the `File` table will be changed. If it partially fails, the table could be left without primary key constraint.
- The primary key for the `Folder` table will be changed. If it partially fails, the table could be left without primary key constraint.
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `uuid` on the `User` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "File" DROP CONSTRAINT "File_folderId_fkey";
-- DropForeignKey
ALTER TABLE "File" DROP CONSTRAINT "File_ownerId_fkey";
-- DropForeignKey
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_owner_user_id_fkey";
-- DropForeignKey
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_parentId_fkey";
-- AlterTable
ALTER TABLE "File" DROP CONSTRAINT "File_pkey",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE TEXT,
ALTER COLUMN "ownerId" SET DATA TYPE TEXT,
ALTER COLUMN "folderId" SET DATA TYPE TEXT,
ADD CONSTRAINT "File_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "File_id_seq";
-- AlterTable
ALTER TABLE "Folder" DROP CONSTRAINT "Folder_pkey",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE TEXT,
ALTER COLUMN "owner_user_id" SET DATA TYPE TEXT,
ALTER COLUMN "parentId" SET DATA TYPE TEXT,
ADD CONSTRAINT "Folder_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "Folder_id_seq";
-- AlterTable
ALTER TABLE "User" DROP CONSTRAINT "User_pkey",
DROP COLUMN "uuid",
ALTER COLUMN "id" DROP DEFAULT,
ALTER COLUMN "id" SET DATA TYPE TEXT,
ADD CONSTRAINT "User_pkey" PRIMARY KEY ("id");
DROP SEQUENCE "User_id_seq";
-- AddForeignKey
ALTER TABLE "File" ADD CONSTRAINT "File_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "File" ADD CONSTRAINT "File_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_owner_user_id_fkey" FOREIGN KEY ("owner_user_id") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Folder" ADD CONSTRAINT "Folder_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Folder"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View file

@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `uuid` on the `File` table. All the data in the column will be lost.
- You are about to drop the column `uuid` on the `Folder` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "File" DROP COLUMN "uuid";
-- AlterTable
ALTER TABLE "Folder" DROP COLUMN "uuid";

View file

@ -5,54 +5,54 @@
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins"]
output = "../node_modules/.prisma/client"
provider = "prisma-client-js"
previewFeatures = ["relationJoins"]
output = "../node_modules/.prisma/client"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique @db.VarChar(50)
email String @unique
password String
files File[]
Folder Folder[]
id String @id @default(uuid())
username String @unique @db.VarChar(50)
email String @unique
password String
files File[]
Folder Folder[]
}
model File {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
url String
size Int
mimetype String
createdAt DateTime @default(now())
owner User? @relation(fields: [ownerId], references: [id])
ownerId Int?
folder Folder? @relation(fields: [folderId], references: [id])
folderId Int?
id String @id @default(uuid())
name String @db.VarChar(255)
url String
size Int
mimetype String
createdAt DateTime @default(now())
owner User? @relation(fields: [ownerId], references: [id])
ownerId String?
folder Folder? @relation(fields: [folderId], references: [id])
folderId String?
}
model Folder {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
creation_date DateTime @default(now())
modification_date DateTime @default(now())
File File[]
owner User? @relation(fields: [owner_user_id], references: [id])
owner_user_id Int?
parentId Int?
parent Folder? @relation("ParentDirectory", fields: [parentId], references: [id])
Directories Folder[] @relation("ParentDirectory")
id String @id @default(uuid())
name String @db.VarChar(255)
creation_date DateTime @default(now())
modification_date DateTime @default(now())
File File[]
owner User? @relation(fields: [owner_user_id], references: [id])
owner_user_id String?
parentId String?
parent Folder? @relation("ParentDirectory", fields: [parentId], references: [id])
Directories Folder[] @relation("ParentDirectory")
}
model Session {
id String @id
sid String @unique
data String
expiresAt DateTime
id String @id
sid String @unique
data String
expiresAt DateTime
}