daphnis/prisma/migrations/20240624144411_authinvite/migration.sql

31 lines
1.2 KiB
MySQL
Raw Normal View History

2024-06-29 05:22:22 +00:00
/*
Warnings:
- A unique constraint covering the columns `[slug]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `name` to the `User` table without a default value. This is not possible if the table is not empty.
- Added the required column `slug` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `user` ADD COLUMN `description` VARCHAR(191) NULL,
ADD COLUMN `name` VARCHAR(191) NOT NULL,
ADD COLUMN `slug` VARCHAR(191) NOT NULL;
-- CreateTable
CREATE TABLE `Invites` (
`email` VARCHAR(191) NOT NULL,
`expires` DATETIME(3) NOT NULL,
`projectId` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`userId` VARCHAR(191) NULL,
INDEX `Invites_projectId_idx`(`projectId`),
UNIQUE INDEX `Invites_email_projectId_key`(`email`, `projectId`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateIndex
CREATE UNIQUE INDEX `User_slug_key` ON `User`(`slug`);
-- AddForeignKey
ALTER TABLE `Invites` ADD CONSTRAINT `Invites_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;