From 0b103fd552717fde814d88a69edaa678086cd5c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Wed, 9 Aug 2023 19:45:23 +0200
Subject: [PATCH] DB => Modify Result table

---
 .../migration.sql                             | 20 +++++++++++++++++++
 ExpressAPI/prisma/schema.prisma               |  7 +++++--
 2 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 ExpressAPI/prisma/migrations/20230809104043_alter_result_for_add_missing_fields/migration.sql

diff --git a/ExpressAPI/prisma/migrations/20230809104043_alter_result_for_add_missing_fields/migration.sql b/ExpressAPI/prisma/migrations/20230809104043_alter_result_for_add_missing_fields/migration.sql
new file mode 100644
index 0000000..85581c3
--- /dev/null
+++ b/ExpressAPI/prisma/migrations/20230809104043_alter_result_for_add_missing_fields/migration.sql
@@ -0,0 +1,20 @@
+/*
+  Warnings:
+
+  - You are about to drop the column `details` on the `Result` table. All the data in the column will be lost.
+  - You are about to drop the column `pass` on the `Result` table. All the data in the column will be lost.
+  - Added the required column `commit` to the `Result` table without a default value. This is not possible if the table is not empty.
+  - Added the required column `exitCode` to the `Result` table without a default value. This is not possible if the table is not empty.
+  - Added the required column `files` to the `Result` table without a default value. This is not possible if the table is not empty.
+  - Added the required column `results` to the `Result` table without a default value. This is not possible if the table is not empty.
+  - Added the required column `success` to the `Result` table without a default value. This is not possible if the table is not empty.
+
+*/
+-- AlterTable
+ALTER TABLE `Result` DROP COLUMN `details`,
+    DROP COLUMN `pass`,
+    ADD COLUMN `commit` JSON NOT NULL,
+    ADD COLUMN `exitCode` INTEGER NOT NULL,
+    ADD COLUMN `files` JSON NOT NULL,
+    ADD COLUMN `results` JSON NOT NULL,
+    ADD COLUMN `success` BOOLEAN NOT NULL;
diff --git a/ExpressAPI/prisma/schema.prisma b/ExpressAPI/prisma/schema.prisma
index 90224e5..7f3f418 100644
--- a/ExpressAPI/prisma/schema.prisma
+++ b/ExpressAPI/prisma/schema.prisma
@@ -54,8 +54,11 @@ model Exercice {
 model Result {
     exerciceId String   @db.Char(36)
     dateTime   DateTime @default(now())
-    pass       Boolean
-    details    String   @db.Text
+    success    Boolean
+    exitCode   Int
+    commit     Json     @db.Json
+    results    Json     @db.Json
+    files      Json     @db.Json
 
     exercice Exercice @relation(fields: [exerciceId], references: [id], onDelete: Cascade, onUpdate: Cascade)
 
-- 
GitLab