82 lines
3.9 KiB
SQL
82 lines
3.9 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- The primary key for the `accounts` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
|
- You are about to drop the column `_id` on the `accounts` table. All the data in the column will be lost.
|
|
- You are about to drop the column `session_state` on the `accounts` table. All the data in the column will be lost.
|
|
- The primary key for the `user` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
|
- You are about to drop the column `_id` on the `user` table. All the data in the column will be lost.
|
|
- The required column `id` was added to the `accounts` 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.
|
|
- Added the required column `updated_at` to the `accounts` table without a default value. This is not possible if the table is not empty.
|
|
- Added the required column `updated_at` to the `sessions` table without a default value. This is not possible if the table is not empty.
|
|
- The required column `id` was added to the `user` 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.
|
|
|
|
*/
|
|
-- DropForeignKey
|
|
ALTER TABLE `accounts` DROP FOREIGN KEY `accounts_user_id_fkey`;
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE `koas-profile` DROP FOREIGN KEY `koas-profile_user_id_fkey`;
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE `likes` DROP FOREIGN KEY `likes_user_id_fkey`;
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE `notifications` DROP FOREIGN KEY `notifications_user_id_fkey`;
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE `pasien-profile` DROP FOREIGN KEY `pasien-profile_user_id_fkey`;
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE `posts` DROP FOREIGN KEY `posts_user_id_fkey`;
|
|
|
|
-- DropForeignKey
|
|
ALTER TABLE `sessions` DROP FOREIGN KEY `sessions_user_id_fkey`;
|
|
|
|
-- DropIndex
|
|
DROP INDEX `sessions_session_token_key` ON `sessions`;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE `accounts` DROP PRIMARY KEY,
|
|
DROP COLUMN `_id`,
|
|
DROP COLUMN `session_state`,
|
|
ADD COLUMN `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
ADD COLUMN `id` VARCHAR(191) NOT NULL,
|
|
ADD COLUMN `updated_at` DATETIME(3) NOT NULL,
|
|
MODIFY `type` VARCHAR(191) NULL,
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
-- AlterTable
|
|
ALTER TABLE `sessions` ADD COLUMN `access_token` TEXT NULL,
|
|
ADD COLUMN `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
ADD COLUMN `updated_at` DATETIME(3) NOT NULL,
|
|
MODIFY `session_token` TEXT NOT NULL,
|
|
MODIFY `user_id` VARCHAR(191) NULL;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE `user` DROP PRIMARY KEY,
|
|
DROP COLUMN `_id`,
|
|
ADD COLUMN `id` VARCHAR(191) NOT NULL,
|
|
ADD PRIMARY KEY (`id`);
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `accounts` ADD CONSTRAINT `accounts_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `sessions` ADD CONSTRAINT `sessions_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `koas-profile` ADD CONSTRAINT `koas-profile_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `pasien-profile` ADD CONSTRAINT `pasien-profile_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `posts` ADD CONSTRAINT `posts_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `likes` ADD CONSTRAINT `likes_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `notifications` ADD CONSTRAINT `notifications_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|