feat: menambahkan prisma migration untuk penambahan mentor, notification, certif uuid constraint, dan remove max_members
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `max_members` on the `project` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[uuid]` on the table `certificate` will be added. If there are existing duplicate values, this will fail.
|
||||
- The required column `uuid` was added to the `certificate` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `admin` MODIFY `role` ENUM('admin', 'mentor', 'intern') NOT NULL DEFAULT 'admin';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `certificate` ADD COLUMN `uuid` VARCHAR(36) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `project` DROP COLUMN `max_members`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `user` MODIFY `role` ENUM('admin', 'mentor', 'intern') NOT NULL DEFAULT 'intern';
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `notification` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`id_user` INTEGER NULL,
|
||||
`id_admin` INTEGER NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`message` TEXT NOT NULL,
|
||||
`is_read` BOOLEAN NOT NULL DEFAULT false,
|
||||
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
|
||||
INDEX `notification_id_user_idx`(`id_user`),
|
||||
INDEX `notification_id_admin_idx`(`id_admin`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `certificate_uuid_key` ON `certificate`(`uuid`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `notification` ADD CONSTRAINT `notification_id_user_fkey` FOREIGN KEY (`id_user`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `notification` ADD CONSTRAINT `notification_id_admin_fkey` FOREIGN KEY (`id_admin`) REFERENCES `admin`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user