/*
  Warnings:

  - You are about to drop the column `avatar` on the `Profile` table. All the data in the column will be lost.
  - Added the required column `eventId` to the `Pictures` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE `Pictures` ADD COLUMN `eventId` VARCHAR(191) NOT NULL;

-- AlterTable
ALTER TABLE `Profile` DROP COLUMN `avatar`,
    ADD COLUMN `name` VARCHAR(191) NULL,
    ADD COLUMN `selectedAvatar` INTEGER NULL;

-- CreateTable
CREATE TABLE `Avatar` (
    `id` VARCHAR(191) NOT NULL,
    `url` VARCHAR(191) NOT NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `profileId` VARCHAR(191) NOT NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `Avatar` ADD CONSTRAINT `Avatar_profileId_fkey` FOREIGN KEY (`profileId`) REFERENCES `Profile`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Pictures` ADD CONSTRAINT `Pictures_eventId_fkey` FOREIGN KEY (`eventId`) REFERENCES `Events`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
