Skip to content
Snippets Groups Projects
Commit b4b190a8 authored by michael.minelli's avatar michael.minelli
Browse files

DB => Update schema

parent e89b7287
Branches
Tags
No related merge requests found
/*
Warnings:
- You are about to drop the column `firstname` on the `User` table. All the data in the column will be lost.
- You are about to drop the column `lastname` on the `User` table. All the data in the column will be lost.
- You are about to drop the column `password` on the `User` table. All the data in the column will be lost.
- A unique constraint covering the columns `[gitlabUsername]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `gitlabUsername` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `User` DROP COLUMN `firstname`,
DROP COLUMN `lastname`,
DROP COLUMN `password`,
ADD COLUMN `gitlabLastInfo` JSON NOT NULL,
ADD COLUMN `gitlabUsername` VARCHAR(191) NOT NULL,
ADD COLUMN `name` VARCHAR(191) NULL;
-- CreateIndex
CREATE UNIQUE INDEX `User_gitlabUsername_key` ON `User`(`gitlabUsername`);
/*
Warnings:
- You are about to alter the column `role` on the `User` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(0))`.
*/
-- AlterTable
ALTER TABLE `User` MODIFY `role` ENUM('STUDENT', 'TEACHING_STAFF', 'ADMIN') NULL DEFAULT 'STUDENT';
/*
Warnings:
- You are about to drop the column `gitlabId` on the `User` table. All the data in the column will be lost.
*/
-- DropIndex
DROP INDEX `User_gitlabId_key` ON `User`;
-- AlterTable
ALTER TABLE `User` DROP COLUMN `gitlabId`,
MODIFY `id` INTEGER NOT NULL;
-- AlterTable
ALTER TABLE `User` ADD COLUMN `gitlabLastRefreshToken` VARCHAR(191) NULL;
/*
Warnings:
- You are about to drop the column `gitlabLastRefreshToken` on the `User` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE `User` DROP COLUMN `gitlabLastRefreshToken`;
...@@ -7,14 +7,19 @@ datasource db { ...@@ -7,14 +7,19 @@ datasource db {
url = env("DATABASE_URL") url = env("DATABASE_URL")
} }
enum UserRole {
STUDENT
TEACHING_STAFF
ADMIN
}
model User { model User {
id Int @id @default(autoincrement()) id Int @id /// The user's id is the same as their gitlab id
firstname String name String?
lastname String?
mail String? @unique mail String? @unique
password String? role UserRole? @default(STUDENT)
gitlabId Int @unique gitlabUsername String @unique
role String? gitlabLastInfo Json @default("{}") @db.Json
deleted Boolean @default(false) deleted Boolean @default(false)
assignments Assignment[] assignments Assignment[]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment