diff --git a/bun.lock b/bun.lock index 127ae62..4f04d94 100644 --- a/bun.lock +++ b/bun.lock @@ -69,7 +69,6 @@ "vscode-languageclient": "^9.0.1", "vscode-ws-jsonrpc": "^3.4.0", "zod": "^3.24.2", - "zod-prisma-types": "^3.2.4", "zustand": "^5.0.3", }, "devDependencies": { @@ -333,8 +332,6 @@ "@prisma/fetch-engine": ["@prisma/fetch-engine@6.6.0", "https://registry.npmmirror.com/@prisma/fetch-engine/-/fetch-engine-6.6.0.tgz", { "dependencies": { "@prisma/debug": "6.6.0", "@prisma/engines-version": "6.6.0-53.f676762280b54cd07c770017ed3711ddde35f37a", "@prisma/get-platform": "6.6.0" } }, "sha512-Ohfo8gKp05LFLZaBlPUApM0M7k43a0jmo86YY35u1/4t+vuQH9mRGU7jGwVzGFY3v+9edeb/cowb1oG4buM1yw=="], - "@prisma/generator-helper": ["@prisma/generator-helper@6.5.0", "https://registry.npmmirror.com/@prisma/generator-helper/-/generator-helper-6.5.0.tgz", { "dependencies": { "@prisma/debug": "6.5.0" } }, "sha512-71ELYxnSE4soeV0BlWJEMgO4KkCowuzHsPY3o7quFOtlcmds5ZX190VZK/k9HMJWdPQ893HooBv3BkKvieR7vA=="], - "@prisma/get-platform": ["@prisma/get-platform@6.6.0", "https://registry.npmmirror.com/@prisma/get-platform/-/get-platform-6.6.0.tgz", { "dependencies": { "@prisma/debug": "6.6.0" } }, "sha512-3qCwmnT4Jh5WCGUrkWcc6VZaw0JY7eWN175/pcb5Z6FiLZZ3ygY93UX0WuV41bG51a6JN/oBH0uywJ90Y+V5eA=="], "@protobufjs/aspromise": ["@protobufjs/aspromise@1.1.2", "https://registry.npmmirror.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", {}, "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="], @@ -675,8 +672,6 @@ "clsx": ["clsx@2.1.1", "https://registry.npmmirror.com/clsx/-/clsx-2.1.1.tgz", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], - "code-block-writer": ["code-block-writer@12.0.0", "https://registry.npmmirror.com/code-block-writer/-/code-block-writer-12.0.0.tgz", {}, "sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w=="], - "collapse-white-space": ["collapse-white-space@2.1.0", "https://registry.npmmirror.com/collapse-white-space/-/collapse-white-space-2.1.0.tgz", {}, "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw=="], "color": ["color@4.2.3", "https://registry.npmmirror.com/color/-/color-4.2.3.tgz", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="], @@ -1133,8 +1128,6 @@ "locate-path": ["locate-path@6.0.0", "https://registry.npmmirror.com/locate-path/-/locate-path-6.0.0.tgz", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], - "lodash": ["lodash@4.17.21", "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], - "lodash.camelcase": ["lodash.camelcase@4.3.0", "https://registry.npmmirror.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", {}, "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="], "lodash.merge": ["lodash.merge@4.6.2", "https://registry.npmmirror.com/lodash.merge/-/lodash.merge-4.6.2.tgz", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="], @@ -1805,8 +1798,6 @@ "zod": ["zod@3.24.2", "https://registry.npmmirror.com/zod/-/zod-3.24.2.tgz", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="], - "zod-prisma-types": ["zod-prisma-types@3.2.4", "https://registry.npmmirror.com/zod-prisma-types/-/zod-prisma-types-3.2.4.tgz", { "dependencies": { "@prisma/generator-helper": "^6.3.0", "code-block-writer": "^12.0.0", "lodash": "^4.17.21", "zod": "^3.24.1" }, "peerDependencies": { "@prisma/client": "^4.x.x || ^5.x.x || ^6.x.x", "prisma": "^4.x.x || ^5.x.x || ^6.x.x" }, "bin": { "zod-prisma-types": "dist/bin.js" } }, "sha512-S4spVBMJAmecLv+aLyRhXK26qW9nWwcsOf1H1fRcEmiI8DPbftZ99u0fhqHlymuTpmMcUpuKxcNNOIqNY0ScSQ=="], - "zod-to-json-schema": ["zod-to-json-schema@3.24.5", "https://registry.npmmirror.com/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g=="], "zustand": ["zustand@5.0.3", "https://registry.npmmirror.com/zustand/-/zustand-5.0.3.tgz", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg=="], @@ -1827,8 +1818,6 @@ "@next/eslint-plugin-next/fast-glob": ["fast-glob@3.3.1", "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.1.tgz", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.4" } }, "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg=="], - "@prisma/generator-helper/@prisma/debug": ["@prisma/debug@6.5.0", "https://registry.npmmirror.com/@prisma/debug/-/debug-6.5.0.tgz", {}, "sha512-fc/nusYBlJMzDmDepdUtH9aBsJrda2JNErP9AzuHbgUEQY0/9zQYZdNlXmKoIWENtio+qarPNe/+DQtrX5kMcQ=="], - "@types/ssh2/@types/node": ["@types/node@18.19.80", "https://registry.npmmirror.com/@types/node/-/node-18.19.80.tgz", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-kEWeMwMeIvxYkeg1gTc01awpwLbfMRZXdIhwRcakd/KlK53jmRC26LqcbIt7fnAQTu5GzlnWmzA3H6+l1u6xxQ=="], "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.5.tgz", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], diff --git a/prisma/migrations/20250311071446_init/migration.sql b/prisma/migrations/20250311071446_init/migration.sql deleted file mode 100644 index ae059d1..0000000 --- a/prisma/migrations/20250311071446_init/migration.sql +++ /dev/null @@ -1,53 +0,0 @@ --- CreateEnum -CREATE TYPE "Role" AS ENUM ('ADMIN', 'TEACHER', 'STUDENT', 'GUEST'); - --- CreateEnum -CREATE TYPE "Difficulty" AS ENUM ('EASY', 'MEDIUM', 'HARD'); - --- CreateEnum -CREATE TYPE "EditorLanguage" AS ENUM ('c', 'cpp'); - --- CreateTable -CREATE TABLE "User" ( - "id" SERIAL NOT NULL, - "name" TEXT NOT NULL, - "email" TEXT NOT NULL, - "role" "Role" NOT NULL DEFAULT 'GUEST', - - CONSTRAINT "User_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Problem" ( - "id" SERIAL NOT NULL, - "title" TEXT NOT NULL, - "description" TEXT NOT NULL, - "solution" TEXT NOT NULL, - "difficulty" "Difficulty" NOT NULL DEFAULT 'EASY', - "published" BOOLEAN NOT NULL DEFAULT false, - "authorId" INTEGER NOT NULL, - - CONSTRAINT "Problem_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Template" ( - "id" SERIAL NOT NULL, - "language" "EditorLanguage" NOT NULL, - "template" TEXT NOT NULL, - "problemId" INTEGER NOT NULL, - - CONSTRAINT "Template_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "User_name_key" ON "User"("name"); - --- CreateIndex -CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); - --- AddForeignKey -ALTER TABLE "Problem" ADD CONSTRAINT "Problem_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Template" ADD CONSTRAINT "Template_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20250312071005_auth/migration.sql b/prisma/migrations/20250312071005_auth/migration.sql deleted file mode 100644 index 56dc5bb..0000000 --- a/prisma/migrations/20250312071005_auth/migration.sql +++ /dev/null @@ -1,124 +0,0 @@ -/* - Warnings: - - - The primary key for the `Problem` table will be changed. If it partially fails, the table could be left without primary key constraint. - - You are about to drop the column `authorId` on the `Problem` table. All the data in the column will be lost. - - The primary key for the `Template` table will be changed. If it partially fails, the table could be left without primary key constraint. - - You are about to drop the column `id` on the `Template` table. All the data in the column will be lost. - - The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. - - Added the required column `userId` to the `Problem` table without a default value. This is not possible if the table is not empty. - - Added the required column `updatedAt` to the `User` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "Problem" DROP CONSTRAINT "Problem_authorId_fkey"; - --- DropForeignKey -ALTER TABLE "Template" DROP CONSTRAINT "Template_problemId_fkey"; - --- DropIndex -DROP INDEX "User_name_key"; - --- AlterTable -ALTER TABLE "Problem" DROP CONSTRAINT "Problem_pkey", -DROP COLUMN "authorId", -ADD COLUMN "userId" TEXT NOT NULL, -ALTER COLUMN "id" DROP DEFAULT, -ALTER COLUMN "id" SET DATA TYPE TEXT, -ADD CONSTRAINT "Problem_pkey" PRIMARY KEY ("id"); -DROP SEQUENCE "Problem_id_seq"; - --- AlterTable -ALTER TABLE "Template" DROP CONSTRAINT "Template_pkey", -DROP COLUMN "id", -ALTER COLUMN "problemId" SET DATA TYPE TEXT, -ADD CONSTRAINT "Template_pkey" PRIMARY KEY ("problemId", "language"); - --- AlterTable -ALTER TABLE "User" DROP CONSTRAINT "User_pkey", -ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, -ADD COLUMN "emailVerified" TIMESTAMP(3), -ADD COLUMN "image" TEXT, -ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL, -ALTER COLUMN "id" DROP DEFAULT, -ALTER COLUMN "id" SET DATA TYPE TEXT, -ADD CONSTRAINT "User_pkey" PRIMARY KEY ("id"); -DROP SEQUENCE "User_id_seq"; - --- CreateTable -CREATE TABLE "Account" ( - "userId" TEXT NOT NULL, - "type" TEXT NOT NULL, - "provider" TEXT NOT NULL, - "providerAccountId" TEXT NOT NULL, - "refresh_token" TEXT, - "access_token" TEXT, - "expires_at" INTEGER, - "token_type" TEXT, - "scope" TEXT, - "id_token" TEXT, - "session_state" TEXT, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Account_pkey" PRIMARY KEY ("provider","providerAccountId") -); - --- CreateTable -CREATE TABLE "Session" ( - "sessionToken" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL -); - --- CreateTable -CREATE TABLE "VerificationToken" ( - "identifier" TEXT NOT NULL, - "token" TEXT NOT NULL, - "expires" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("identifier","token") -); - --- CreateTable -CREATE TABLE "Authenticator" ( - "credentialID" TEXT NOT NULL, - "userId" TEXT NOT NULL, - "providerAccountId" TEXT NOT NULL, - "credentialPublicKey" TEXT NOT NULL, - "counter" INTEGER NOT NULL, - "credentialDeviceType" TEXT NOT NULL, - "credentialBackedUp" BOOLEAN NOT NULL, - "transports" TEXT, - - CONSTRAINT "Authenticator_pkey" PRIMARY KEY ("userId","credentialID") -); - --- CreateIndex -CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); - --- CreateIndex -CREATE UNIQUE INDEX "Authenticator_credentialID_key" ON "Authenticator"("credentialID"); - --- CreateIndex -CREATE INDEX "Problem_userId_idx" ON "Problem"("userId"); - --- CreateIndex -CREATE INDEX "Problem_difficulty_idx" ON "Problem"("difficulty"); - --- AddForeignKey -ALTER TABLE "Problem" ADD CONSTRAINT "Problem_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Template" ADD CONSTRAINT "Template_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Authenticator" ADD CONSTRAINT "Authenticator_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20250313161756_credentials/migration.sql b/prisma/migrations/20250313161756_credentials/migration.sql deleted file mode 100644 index c48c2d1..0000000 --- a/prisma/migrations/20250313161756_credentials/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ --- AlterTable -ALTER TABLE "User" ADD COLUMN "password" TEXT, -ALTER COLUMN "name" DROP NOT NULL, -ALTER COLUMN "email" DROP NOT NULL; diff --git a/prisma/migrations/20250316054114_editor_language_config/migration.sql b/prisma/migrations/20250316054114_editor_language_config/migration.sql deleted file mode 100644 index 409770f..0000000 --- a/prisma/migrations/20250316054114_editor_language_config/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ --- CreateTable -CREATE TABLE "EditorLanguageConfig" ( - "id" TEXT NOT NULL, - "language" "EditorLanguage" NOT NULL, - "label" TEXT NOT NULL, - "fileName" TEXT NOT NULL, - "fileExtension" TEXT NOT NULL, - - CONSTRAINT "EditorLanguageConfig_pkey" PRIMARY KEY ("id") -); diff --git a/prisma/migrations/20250316061109_remove_id_from_editor_language_config/migration.sql b/prisma/migrations/20250316061109_remove_id_from_editor_language_config/migration.sql deleted file mode 100644 index cc13580..0000000 --- a/prisma/migrations/20250316061109_remove_id_from_editor_language_config/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - The primary key for the `EditorLanguageConfig` table will be changed. If it partially fails, the table could be left without primary key constraint. - - You are about to drop the column `id` on the `EditorLanguageConfig` table. All the data in the column will be lost. - - A unique constraint covering the columns `[language]` on the table `EditorLanguageConfig` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterTable -ALTER TABLE "EditorLanguageConfig" DROP CONSTRAINT "EditorLanguageConfig_pkey", -DROP COLUMN "id"; - --- CreateIndex -CREATE UNIQUE INDEX "EditorLanguageConfig_language_key" ON "EditorLanguageConfig"("language"); diff --git a/prisma/migrations/20250316063853_add_language_server_config/migration.sql b/prisma/migrations/20250316063853_add_language_server_config/migration.sql deleted file mode 100644 index 37453f0..0000000 --- a/prisma/migrations/20250316063853_add_language_server_config/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ --- CreateTable -CREATE TABLE "LanguageServerConfig" ( - "language" "EditorLanguage" NOT NULL, - "protocol" TEXT NOT NULL, - "hostname" TEXT NOT NULL, - "port" INTEGER, - "path" TEXT -); - --- CreateIndex -CREATE UNIQUE INDEX "LanguageServerConfig_language_key" ON "LanguageServerConfig"("language"); - --- AddForeignKey -ALTER TABLE "LanguageServerConfig" ADD CONSTRAINT "LanguageServerConfig_language_fkey" FOREIGN KEY ("language") REFERENCES "EditorLanguageConfig"("language") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20250316084524_add_docker_config_to_editor_language/migration.sql b/prisma/migrations/20250316084524_add_docker_config_to_editor_language/migration.sql deleted file mode 100644 index db90637..0000000 --- a/prisma/migrations/20250316084524_add_docker_config_to_editor_language/migration.sql +++ /dev/null @@ -1,17 +0,0 @@ --- CreateTable -CREATE TABLE "DockerConfig" ( - "language" "EditorLanguage" NOT NULL, - "image" TEXT NOT NULL, - "tag" TEXT NOT NULL, - "workingDir" TEXT NOT NULL, - "timeLimit" INTEGER NOT NULL, - "memoryLimit" INTEGER NOT NULL, - "compileOutputLimit" INTEGER NOT NULL, - "runOutputLimit" INTEGER NOT NULL -); - --- CreateIndex -CREATE UNIQUE INDEX "DockerConfig_language_key" ON "DockerConfig"("language"); - --- AddForeignKey -ALTER TABLE "DockerConfig" ADD CONSTRAINT "DockerConfig_language_fkey" FOREIGN KEY ("language") REFERENCES "EditorLanguageConfig"("language") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20250316091326_add_exit_code_enum/migration.sql b/prisma/migrations/20250316091326_add_exit_code_enum/migration.sql deleted file mode 100644 index 875ead9..0000000 --- a/prisma/migrations/20250316091326_add_exit_code_enum/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- CreateEnum -CREATE TYPE "ExitCode" AS ENUM ('SE', 'CS', 'CE', 'TLE', 'MLE', 'RE', 'AC', 'WA'); diff --git a/prisma/migrations/20250316110650_add_judge_result_model/migration.sql b/prisma/migrations/20250316110650_add_judge_result_model/migration.sql deleted file mode 100644 index fd0edb5..0000000 --- a/prisma/migrations/20250316110650_add_judge_result_model/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ --- CreateTable -CREATE TABLE "JudgeResult" ( - "id" TEXT NOT NULL, - "output" TEXT NOT NULL, - "exitCode" "ExitCode" NOT NULL, - "executionTime" INTEGER, - "memoryUsage" INTEGER, - - CONSTRAINT "JudgeResult_pkey" PRIMARY KEY ("id") -); diff --git a/prisma/migrations/20250318034516_add_language_server_protocol_enum/migration.sql b/prisma/migrations/20250318034516_add_language_server_protocol_enum/migration.sql deleted file mode 100644 index 9135c04..0000000 --- a/prisma/migrations/20250318034516_add_language_server_protocol_enum/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - Changed the type of `protocol` on the `LanguageServerConfig` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. - -*/ --- CreateEnum -CREATE TYPE "LanguageServerProtocol" AS ENUM ('ws', 'wss'); - --- AlterTable -ALTER TABLE "LanguageServerConfig" DROP COLUMN "protocol", -ADD COLUMN "protocol" "LanguageServerProtocol" NOT NULL; diff --git a/prisma/migrations/20250321031353_remove_teacher_student_roles/migration.sql b/prisma/migrations/20250321031353_remove_teacher_student_roles/migration.sql deleted file mode 100644 index f47ae02..0000000 --- a/prisma/migrations/20250321031353_remove_teacher_student_roles/migration.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - Warnings: - - - The values [TEACHER,STUDENT] on the enum `Role` will be removed. If these variants are still used in the database, this will fail. - -*/ --- AlterEnum -BEGIN; -CREATE TYPE "Role_new" AS ENUM ('ADMIN', 'GUEST'); -ALTER TABLE "User" ALTER COLUMN "role" DROP DEFAULT; -ALTER TABLE "User" ALTER COLUMN "role" TYPE "Role_new" USING ("role"::text::"Role_new"); -ALTER TYPE "Role" RENAME TO "Role_old"; -ALTER TYPE "Role_new" RENAME TO "Role"; -DROP TYPE "Role_old"; -ALTER TABLE "User" ALTER COLUMN "role" SET DEFAULT 'GUEST'; -COMMIT; diff --git a/prisma/migrations/20250330104040_add_problem_display_id/migration.sql b/prisma/migrations/20250330104040_add_problem_display_id/migration.sql deleted file mode 100644 index a734a3b..0000000 --- a/prisma/migrations/20250330104040_add_problem_display_id/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[displayId]` on the table `Problem` will be added. If there are existing duplicate values, this will fail. - - Added the required column `displayId` to the `Problem` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Problem" ADD COLUMN "displayId" INTEGER NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "Problem_displayId_key" ON "Problem"("displayId"); diff --git a/prisma/migrations/20250409113027_add_testcase_and_testcasedata_models/migration.sql b/prisma/migrations/20250409113027_add_testcase_and_testcasedata_models/migration.sql deleted file mode 100644 index 95da825..0000000 --- a/prisma/migrations/20250409113027_add_testcase_and_testcasedata_models/migration.sql +++ /dev/null @@ -1,23 +0,0 @@ --- CreateTable -CREATE TABLE "Testcase" ( - "id" TEXT NOT NULL, - "problemId" TEXT NOT NULL, - - CONSTRAINT "Testcase_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "TestcaseData" ( - "id" TEXT NOT NULL, - "label" TEXT NOT NULL, - "value" TEXT NOT NULL, - "testcaseId" TEXT NOT NULL, - - CONSTRAINT "TestcaseData_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "Testcase" ADD CONSTRAINT "Testcase_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "TestcaseData" ADD CONSTRAINT "TestcaseData_testcaseId_fkey" FOREIGN KEY ("testcaseId") REFERENCES "Testcase"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20250410021857_add_expected_output_to_testcase/migration.sql b/prisma/migrations/20250410021857_add_expected_output_to_testcase/migration.sql deleted file mode 100644 index 8638212..0000000 --- a/prisma/migrations/20250410021857_add_expected_output_to_testcase/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `expectedOutput` to the `Testcase` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Testcase" ADD COLUMN "expectedOutput" TEXT NOT NULL; diff --git a/prisma/migrations/20250410133520_move_limits_to_problem/migration.sql b/prisma/migrations/20250410133520_move_limits_to_problem/migration.sql deleted file mode 100644 index 60c0db0..0000000 --- a/prisma/migrations/20250410133520_move_limits_to_problem/migration.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `memoryLimit` on the `DockerConfig` table. All the data in the column will be lost. - - You are about to drop the column `timeLimit` on the `DockerConfig` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "DockerConfig" DROP COLUMN "memoryLimit", -DROP COLUMN "timeLimit"; - --- AlterTable -ALTER TABLE "Problem" ADD COLUMN "memoryLimit" INTEGER NOT NULL DEFAULT 128, -ADD COLUMN "timeLimit" INTEGER NOT NULL DEFAULT 1000; diff --git a/prisma/migrations/20250410142543_add_submission_and_relations/migration.sql b/prisma/migrations/20250410142543_add_submission_and_relations/migration.sql deleted file mode 100644 index 9cc665f..0000000 --- a/prisma/migrations/20250410142543_add_submission_and_relations/migration.sql +++ /dev/null @@ -1,37 +0,0 @@ -/* - Warnings: - - - You are about to drop the `JudgeResult` table. If the table is not empty, all the data it contains will be lost. - -*/ --- CreateEnum -CREATE TYPE "Status" AS ENUM ('PD', 'QD', 'CP', 'CE', 'CS', 'RU', 'TLE', 'MLE', 'RE', 'AC', 'WA', 'SE'); - --- DropTable -DROP TABLE "JudgeResult"; - --- DropEnum -DROP TYPE "ExitCode"; - --- CreateTable -CREATE TABLE "Submission" ( - "id" TEXT NOT NULL, - "language" "EditorLanguage" NOT NULL, - "code" TEXT NOT NULL, - "status" "Status" NOT NULL, - "message" TEXT, - "executionTime" INTEGER, - "memoryUsage" INTEGER, - "userId" TEXT NOT NULL, - "problemId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Submission_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "Submission" ADD CONSTRAINT "Submission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Submission" ADD CONSTRAINT "Submission_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20250411075521_add_testcase_result_model/migration.sql b/prisma/migrations/20250411075521_add_testcase_result_model/migration.sql deleted file mode 100644 index b1c8345..0000000 --- a/prisma/migrations/20250411075521_add_testcase_result_model/migration.sql +++ /dev/null @@ -1,29 +0,0 @@ -/* - Warnings: - - - Added the required column `index` to the `TestcaseData` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "TestcaseData" ADD COLUMN "index" INTEGER NOT NULL; - --- CreateTable -CREATE TABLE "TestcaseResult" ( - "id" TEXT NOT NULL, - "isCorrect" BOOLEAN NOT NULL, - "output" TEXT NOT NULL, - "executionTime" INTEGER, - "memoryUsage" INTEGER, - "submissionId" TEXT NOT NULL, - "testcaseId" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "TestcaseResult_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "TestcaseResult" ADD CONSTRAINT "TestcaseResult_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "Submission"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "TestcaseResult" ADD CONSTRAINT "TestcaseResult_testcaseId_fkey" FOREIGN KEY ("testcaseId") REFERENCES "Testcase"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20250507130854_add_problem_multilingual_support/migration.sql b/prisma/migrations/20250507130854_add_problem_multilingual_support/migration.sql deleted file mode 100644 index 07cbae8..0000000 --- a/prisma/migrations/20250507130854_add_problem_multilingual_support/migration.sql +++ /dev/null @@ -1,63 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `description` on the `Problem` table. All the data in the column will be lost. - - You are about to drop the column `solution` on the `Problem` table. All the data in the column will be lost. - - You are about to drop the column `title` on the `Problem` table. All the data in the column will be lost. - -*/ --- CreateEnum -CREATE TYPE "Language" AS ENUM ('en', 'zh'); - --- AlterTable -ALTER TABLE "Problem" DROP COLUMN "description", -DROP COLUMN "solution", -DROP COLUMN "title"; - --- CreateTable -CREATE TABLE "ProblemTitle" ( - "id" TEXT NOT NULL, - "language" "Language" NOT NULL, - "content" TEXT NOT NULL, - "problemId" TEXT NOT NULL, - - CONSTRAINT "ProblemTitle_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ProblemDescription" ( - "id" TEXT NOT NULL, - "language" "Language" NOT NULL, - "content" TEXT NOT NULL, - "problemId" TEXT NOT NULL, - - CONSTRAINT "ProblemDescription_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ProblemSolution" ( - "id" TEXT NOT NULL, - "language" "Language" NOT NULL, - "content" TEXT NOT NULL, - "problemId" TEXT NOT NULL, - - CONSTRAINT "ProblemSolution_pkey" PRIMARY KEY ("id") -); - --- CreateIndex -CREATE UNIQUE INDEX "ProblemTitle_problemId_language_key" ON "ProblemTitle"("problemId", "language"); - --- CreateIndex -CREATE UNIQUE INDEX "ProblemDescription_problemId_language_key" ON "ProblemDescription"("problemId", "language"); - --- CreateIndex -CREATE UNIQUE INDEX "ProblemSolution_problemId_language_key" ON "ProblemSolution"("problemId", "language"); - --- AddForeignKey -ALTER TABLE "ProblemTitle" ADD CONSTRAINT "ProblemTitle_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ProblemDescription" ADD CONSTRAINT "ProblemDescription_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ProblemSolution" ADD CONSTRAINT "ProblemSolution_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20250512114103_refactor_schema_consolidation/migration.sql b/prisma/migrations/20250512114103_refactor_schema_consolidation/migration.sql new file mode 100644 index 0000000..20ba214 --- /dev/null +++ b/prisma/migrations/20250512114103_refactor_schema_consolidation/migration.sql @@ -0,0 +1,244 @@ +-- CreateEnum +CREATE TYPE "Role" AS ENUM ('ADMIN', 'GUEST'); + +-- CreateEnum +CREATE TYPE "Difficulty" AS ENUM ('EASY', 'MEDIUM', 'HARD'); + +-- CreateEnum +CREATE TYPE "Locale" AS ENUM ('en', 'zh'); + +-- CreateEnum +CREATE TYPE "Language" AS ENUM ('c', 'cpp'); + +-- CreateEnum +CREATE TYPE "Protocol" AS ENUM ('ws', 'wss'); + +-- CreateEnum +CREATE TYPE "Status" AS ENUM ('PD', 'QD', 'CP', 'CE', 'CS', 'RU', 'TLE', 'MLE', 'RE', 'AC', 'WA', 'SE'); + +-- CreateEnum +CREATE TYPE "ProblemContentType" AS ENUM ('TITLE', 'DESCRIPTION', 'SOLUTION'); + +-- CreateTable +CREATE TABLE "User" ( + "id" TEXT NOT NULL, + "name" TEXT, + "email" TEXT NOT NULL, + "emailVerified" TIMESTAMP(3), + "image" TEXT, + "role" "Role" NOT NULL DEFAULT 'GUEST', + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Problem" ( + "id" TEXT NOT NULL, + "displayId" INTEGER NOT NULL, + "difficulty" "Difficulty" NOT NULL DEFAULT 'EASY', + "isPublished" BOOLEAN NOT NULL DEFAULT false, + "timeLimit" INTEGER NOT NULL DEFAULT 1000, + "memoryLimit" INTEGER NOT NULL DEFAULT 134217728, + "userId" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Problem_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "ProblemLocalization" ( + "problemId" TEXT NOT NULL, + "locale" "Locale" NOT NULL, + "type" "ProblemContentType" NOT NULL, + "content" TEXT NOT NULL, + + CONSTRAINT "ProblemLocalization_pkey" PRIMARY KEY ("problemId","locale","type") +); + +-- CreateTable +CREATE TABLE "Template" ( + "problemId" TEXT NOT NULL, + "language" "Language" NOT NULL, + "content" TEXT NOT NULL, + + CONSTRAINT "Template_pkey" PRIMARY KEY ("problemId","language") +); + +-- CreateTable +CREATE TABLE "Submission" ( + "id" TEXT NOT NULL, + "language" "Language" NOT NULL, + "content" TEXT NOT NULL, + "status" "Status" NOT NULL, + "message" TEXT, + "timeUsage" INTEGER, + "memoryUsage" INTEGER, + "userId" TEXT NOT NULL, + "problemId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Submission_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Testcase" ( + "id" TEXT NOT NULL, + "expectedOutput" TEXT NOT NULL, + "problemId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Testcase_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "TestcaseInput" ( + "id" TEXT NOT NULL, + "index" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "value" TEXT NOT NULL, + "testcaseId" TEXT NOT NULL, + + CONSTRAINT "TestcaseInput_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "TestcaseResult" ( + "id" TEXT NOT NULL, + "isCorrect" BOOLEAN NOT NULL, + "output" TEXT NOT NULL, + "timeUsage" INTEGER, + "memoryUsage" INTEGER, + "submissionId" TEXT NOT NULL, + "testcaseId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "TestcaseResult_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "DockerConfig" ( + "language" "Language" NOT NULL, + "image" TEXT NOT NULL, + "tag" TEXT NOT NULL, + "workingDir" TEXT NOT NULL, + "compileOutputLimit" INTEGER NOT NULL DEFAULT 1048576, + "runOutputLimit" INTEGER NOT NULL DEFAULT 1048576, + + CONSTRAINT "DockerConfig_pkey" PRIMARY KEY ("language") +); + +-- CreateTable +CREATE TABLE "LanguageServerConfig" ( + "language" "Language" NOT NULL, + "protocol" "Protocol" NOT NULL, + "hostname" TEXT NOT NULL, + "port" INTEGER, + "path" TEXT, + + CONSTRAINT "LanguageServerConfig_pkey" PRIMARY KEY ("language") +); + +-- CreateTable +CREATE TABLE "Account" ( + "userId" TEXT NOT NULL, + "type" TEXT NOT NULL, + "provider" TEXT NOT NULL, + "providerAccountId" TEXT NOT NULL, + "refresh_token" TEXT, + "access_token" TEXT, + "expires_at" INTEGER, + "token_type" TEXT, + "scope" TEXT, + "id_token" TEXT, + "session_state" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "Account_pkey" PRIMARY KEY ("provider","providerAccountId") +); + +-- CreateTable +CREATE TABLE "Session" ( + "sessionToken" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "expires" TIMESTAMP(3) NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL +); + +-- CreateTable +CREATE TABLE "VerificationToken" ( + "identifier" TEXT NOT NULL, + "token" TEXT NOT NULL, + "expires" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("identifier","token") +); + +-- CreateTable +CREATE TABLE "Authenticator" ( + "credentialID" TEXT NOT NULL, + "userId" TEXT NOT NULL, + "providerAccountId" TEXT NOT NULL, + "credentialPublicKey" TEXT NOT NULL, + "counter" INTEGER NOT NULL, + "credentialDeviceType" TEXT NOT NULL, + "credentialBackedUp" BOOLEAN NOT NULL, + "transports" TEXT, + + CONSTRAINT "Authenticator_pkey" PRIMARY KEY ("userId","credentialID") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "Problem_displayId_key" ON "Problem"("displayId"); + +-- CreateIndex +CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); + +-- CreateIndex +CREATE UNIQUE INDEX "Authenticator_credentialID_key" ON "Authenticator"("credentialID"); + +-- AddForeignKey +ALTER TABLE "Problem" ADD CONSTRAINT "Problem_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "ProblemLocalization" ADD CONSTRAINT "ProblemLocalization_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Template" ADD CONSTRAINT "Template_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Submission" ADD CONSTRAINT "Submission_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Submission" ADD CONSTRAINT "Submission_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Testcase" ADD CONSTRAINT "Testcase_problemId_fkey" FOREIGN KEY ("problemId") REFERENCES "Problem"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "TestcaseInput" ADD CONSTRAINT "TestcaseInput_testcaseId_fkey" FOREIGN KEY ("testcaseId") REFERENCES "Testcase"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "TestcaseResult" ADD CONSTRAINT "TestcaseResult_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "Submission"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "TestcaseResult" ADD CONSTRAINT "TestcaseResult_testcaseId_fkey" FOREIGN KEY ("testcaseId") REFERENCES "Testcase"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Authenticator" ADD CONSTRAINT "Authenticator_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 671d0c4..8ebaa21 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -182,16 +182,6 @@ model TestcaseResult { updatedAt DateTime @updatedAt } -model LanguageConfig { - language Language @id - displayName String - fileName String - fileExtension String - - dockerConfig DockerConfig? - languageServerConfig LanguageServerConfig? -} - model DockerConfig { language Language @id image String @@ -199,8 +189,6 @@ model DockerConfig { workingDir String compileOutputLimit Int @default(1048576) runOutputLimit Int @default(1048576) - - languageConfig LanguageConfig @relation(fields: [language], references: [language], onDelete: Cascade) } model LanguageServerConfig { @@ -209,8 +197,6 @@ model LanguageServerConfig { hostname String port Int? path String? - - languageConfig LanguageConfig @relation(fields: [language], references: [language], onDelete: Cascade) } model Account {