-- AlterTable
ALTER TABLE `discussions` ADD COLUMN `coach_id` INTEGER NULL;

-- CreateIndex
CREATE INDEX `discussions_coach_id_idx` ON `discussions`(`coach_id`);

-- CreateIndex
CREATE INDEX `discussions_user_id_coach_id_idx` ON `discussions`(`user_id`, `coach_id`);

-- CreateIndex
CREATE INDEX `discussions_user_id_status_idx` ON `discussions`(`user_id`, `status`);

-- CreateIndex
CREATE INDEX `discussions_coach_id_status_idx` ON `discussions`(`coach_id`, `status`);

-- CreateIndex
CREATE INDEX `discussions_status_idx` ON `discussions`(`status`);

-- AddForeignKey
ALTER TABLE `discussions` ADD CONSTRAINT `discussions_coach_id_fkey` FOREIGN KEY (`coach_id`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
