My-Weekly-ToDo-List/prisma/migrations/20260220_add_soft_delete/migration.sql
mARTin ccb34d12d5 feat: Add soft delete, remove Apple Reminders, improve Google Tasks sync
Add soft-delete support for tasks with deletedAt field and migration.
Remove Apple Reminders iCloud integration entirely (API routes, lib,
UI modal, and Python script) in favor of CalDAV approach. Add periodic
pull-sync from Google Tasks every 2 minutes with deletion detection.
Fix orphaned someday task rescue and cross-list task toggle/edit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 09:04:49 +01:00

11 lines
596 B
SQL

-- AlterTable: Add soft delete column to Task
ALTER TABLE "Task" ADD COLUMN "deletedAt" TIMESTAMP(3);
-- CreateIndex: Index for efficient filtering of non-deleted tasks
CREATE INDEX "Task_userId_deletedAt_idx" ON "Task"("userId", "deletedAt");
-- AlterTable: Change onDelete behavior for somedayList relation
-- Drop old foreign key and add new one with SET NULL
ALTER TABLE "Task" DROP CONSTRAINT IF EXISTS "Task_somedayListId_fkey";
ALTER TABLE "Task" ADD CONSTRAINT "Task_somedayListId_fkey" FOREIGN KEY ("somedayListId") REFERENCES "SomedayList"("id") ON DELETE SET NULL ON UPDATE CASCADE;