/*
  Warnings:

  - You are about to drop the `dailies` table. If the table is not empty, all the data it contains will be lost.
  - You are about to drop the column `dailyId` on the `daily_checkboxes` table. All the data in the column will be lost.
  - You are about to drop the column `section` on the `daily_checkboxes` table. All the data in the column will be lost.
  - Added the required column `date` to the `daily_checkboxes` table without a default value. This is not possible if the table is not empty.

*/
-- DropIndex
DROP INDEX "dailies_date_key";

-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "dailies";
PRAGMA foreign_keys=on;

-- 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,
    "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", "id", "isChecked", "order", "taskId", "text", "updatedAt") SELECT "createdAt", "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;
