Skip to content

Commit

Permalink
chore(prisma): add responsible table, modify adminInfo table (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlnwbr authored Mar 7, 2024
1 parent 1fe991a commit b8c1370
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Warnings:
- You are about to drop the column `student` on the `admininfo` table. All the data in the column will be lost.
- You are about to drop the column `supervisor` on the `admininfo` table. All the data in the column will be lost.
- You are about to drop the column `title` on the `admininfo` table. All the data in the column will be lost.
- You are about to drop the column `type` on the `admininfo` table. All the data in the column will be lost.
- You are about to alter the column `status` on the `admininfo` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(0))`.
- A unique constraint covering the columns `[proposalId]` on the table `AdminInfo` will be added. If there are existing duplicate values, this will fail.
- Added the required column `proposalId` to the `AdminInfo` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `admininfo` DROP COLUMN `student`,
DROP COLUMN `supervisor`,
DROP COLUMN `title`,
DROP COLUMN `type`,
ADD COLUMN `proposalId` VARCHAR(191) NOT NULL,
MODIFY `status` ENUM('OPEN', 'SUBMITTED', 'IN_PROGRESS', 'UNDER_REVIEW', 'COMPLETED') NULL;

-- AlterTable
ALTER TABLE `userproposalsupervision` ADD COLUMN `responsibleId` VARCHAR(191) NULL;

-- CreateTable
CREATE TABLE `Responsible` (
`id` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`email` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),

UNIQUE INDEX `Responsible_id_key`(`id`),
UNIQUE INDEX `Responsible_email_key`(`email`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateIndex
CREATE UNIQUE INDEX `AdminInfo_proposalId_key` ON `AdminInfo`(`proposalId`);

-- AddForeignKey
ALTER TABLE `UserProposalSupervision` ADD CONSTRAINT `UserProposalSupervision_responsibleId_fkey` FOREIGN KEY (`responsibleId`) REFERENCES `Responsible`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

-- AddForeignKey
ALTER TABLE `AdminInfo` ADD CONSTRAINT `AdminInfo_proposalId_fkey` FOREIGN KEY (`proposalId`) REFERENCES `Proposal`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
54 changes: 38 additions & 16 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ model ApplicationAttachment {
model Proposal {
id String @id @unique @default(uuid())
title String
description String @db.Text
language String
studyLevel String
timeFrame String?
title String
description String @db.Text
language String
studyLevel String
timeFrame String?
additionalStudentComment String? @db.Text
topicArea TopicArea @relation(fields: [topicAreaSlug], references: [slug])
Expand All @@ -143,6 +143,7 @@ model Proposal {
supervisedBy UserProposalSupervision[]
applications ProposalApplication[]
receivedFeedbacks UserProposalFeedback[]
AdminInfo AdminInfo?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
Expand Down Expand Up @@ -180,7 +181,9 @@ model UserProposalSupervision {
proposal Proposal @relation(fields: [proposalId], references: [id], onDelete: Cascade)
proposalId String @unique
supervisor User? @relation(fields: [supervisorEmail], references: [email], onUpdate: NoAction, onDelete: NoAction)
responsible Responsible? @relation(fields: [responsibleId], references: [id], onUpdate: NoAction, onDelete: NoAction)
responsibleId String?
supervisor User? @relation(fields: [supervisorEmail], references: [email], onUpdate: NoAction, onDelete: NoAction)
supervisorEmail String?
application ProposalApplication[]
Expand Down Expand Up @@ -213,20 +216,39 @@ model UserProposalFeedback {
@@unique([proposalId, userEmail])
}

enum Status {
OPEN
SUBMITTED
IN_PROGRESS
UNDER_REVIEW
COMPLETED
}

model AdminInfo {
id String @id @unique @default(uuid())
mailReceived String?
supervisor String?
student String?
title String?
type String?
status String?
proposal Proposal @relation(fields: [proposalId], references: [id], onDelete: Cascade)
proposalId String @unique
mailReceived String?
status Status?
olatCapturedDate DateTime?
submissionDate DateTime?
grade Float?
olatGradeDate DateTime?
submissionDate DateTime?
grade Float?
olatGradeDate DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}

model Responsible {
id String @id @unique @default(uuid())
name String
email String @unique
supervisions UserProposalSupervision[]
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}
}

0 comments on commit b8c1370

Please sign in to comment.