-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_daily_checkboxes" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "date" DATETIME NOT NULL,
    "text" TEXT NOT NULL,
    "isChecked" BOOLEAN NOT NULL DEFAULT false,
    "type" TEXT NOT NULL DEFAULT 'task',
    "order" INTEGER NOT NULL DEFAULT 0,
    "taskId" TEXT,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL,
    CONSTRAINT "daily_checkboxes_taskId_fkey" FOREIGN KEY ("taskId") REFERENCES "tasks" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_daily_checkboxes" ("createdAt", "date", "id", "isChecked", "order", "taskId", "text", "updatedAt") SELECT "createdAt", "date", "id", "isChecked", "order", "taskId", "text", "updatedAt" FROM "daily_checkboxes";
DROP TABLE "daily_checkboxes";
ALTER TABLE "new_daily_checkboxes" RENAME TO "daily_checkboxes";
CREATE INDEX "daily_checkboxes_date_idx" ON "daily_checkboxes"("date");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
