diff --git a/ExpressAPI/prisma/migrations/20240430110701_add_assignment_secret/migration.sql b/ExpressAPI/prisma/migrations/20240430110701_add_assignment_secret/migration.sql new file mode 100644 index 0000000000000000000000000000000000000000..7e74c26bb03855dbafe2ef144adb3b74d96aada3 --- /dev/null +++ b/ExpressAPI/prisma/migrations/20240430110701_add_assignment_secret/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE `Assignment` ADD COLUMN `secret` CHAR(36) NULL; +UPDATE `Assignment` SET `secret` = uuid(); \ No newline at end of file diff --git a/ExpressAPI/prisma/migrations/20240430110915_make_assignment_secret_unique/migration.sql b/ExpressAPI/prisma/migrations/20240430110915_make_assignment_secret_unique/migration.sql new file mode 100644 index 0000000000000000000000000000000000000000..ee45877fb55ae67715d7973e4b45ebcfe2b163e9 --- /dev/null +++ b/ExpressAPI/prisma/migrations/20240430110915_make_assignment_secret_unique/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - A unique constraint covering the columns `[secret]` on the table `Assignment` will be added. If there are existing duplicate values, this will fail. + - Made the column `secret` on table `Assignment` required. This step will fail if there are existing NULL values in that column. + +*/ +-- AlterTable +ALTER TABLE `Assignment` MODIFY `secret` CHAR(36) NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX `Assignment_secret_key` ON `Assignment`(`secret`); diff --git a/ExpressAPI/prisma/schema.prisma b/ExpressAPI/prisma/schema.prisma index 2d894bb90374fe02b8cc688f5c6118260b02fb52..ee2c0f1197d7edab927913132056f2d21725ef47 100644 --- a/ExpressAPI/prisma/schema.prisma +++ b/ExpressAPI/prisma/schema.prisma @@ -35,6 +35,7 @@ model User { model Assignment { name String @id + secret String @unique @db.Char(36) gitlabId Int gitlabLink String gitlabCreationInfo Json @db.Json