From 4a81900adacca731883f947c02429c27d75ad221 Mon Sep 17 00:00:00 2001 From: Lucky Indra Efendi Date: Mon, 3 Jun 2024 12:52:51 +0700 Subject: [PATCH] add migration --- .../20240603055241_mangazuna/migration.sql | 32 +++++++++++++++++++ prisma/migrations/migration_lock.toml | 3 ++ 2 files changed, 35 insertions(+) create mode 100644 prisma/migrations/20240603055241_mangazuna/migration.sql create mode 100644 prisma/migrations/migration_lock.toml diff --git a/prisma/migrations/20240603055241_mangazuna/migration.sql b/prisma/migrations/20240603055241_mangazuna/migration.sql new file mode 100644 index 0000000..9b1dbe8 --- /dev/null +++ b/prisma/migrations/20240603055241_mangazuna/migration.sql @@ -0,0 +1,32 @@ +-- CreateTable +CREATE TABLE `user` ( + `id` VARCHAR(191) NOT NULL, + `username` VARCHAR(191) NOT NULL, + `email` VARCHAR(191) NOT NULL, + `password` VARCHAR(191) NOT NULL, + `bio` VARCHAR(191) NULL DEFAULT 'I Like Mangazuna', + `emailVerified` DATETIME(3) NULL, + `image` VARCHAR(191) NULL DEFAULT 'https://res.cloudinary.com/dyr5sva6n/image/upload/v1702635115/profile/profile_temmit.jpg', + `role` ENUM('ADMIN', 'USER') NOT NULL DEFAULT 'USER', + `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + + UNIQUE INDEX `user_email_key`(`email`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `bookmark` ( + `id` VARCHAR(191) NOT NULL, + `title` VARCHAR(191) NOT NULL, + `image` VARCHAR(191) NOT NULL, + `url` VARCHAR(191) NOT NULL, + `rating` VARCHAR(191) NOT NULL, + `total_chapters` INTEGER NOT NULL, + `userId` VARCHAR(191) NULL, + + INDEX `bookmark_userId_idx`(`userId`), + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- AddForeignKey +ALTER TABLE `bookmark` ADD CONSTRAINT `bookmark_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..e5a788a --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "mysql" \ No newline at end of file