-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_AttendancePunch" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "attendanceId" TEXT NOT NULL,
    "checkIn" DATETIME,
    "checkOut" DATETIME,
    "deviceSource" TEXT,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT "AttendancePunch_attendanceId_fkey" FOREIGN KEY ("attendanceId") REFERENCES "Attendance" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_AttendancePunch" ("attendanceId", "checkIn", "checkOut", "createdAt", "deviceSource", "id") SELECT "attendanceId", "checkIn", "checkOut", "createdAt", "deviceSource", "id" FROM "AttendancePunch";
DROP TABLE "AttendancePunch";
ALTER TABLE "new_AttendancePunch" RENAME TO "AttendancePunch";
CREATE INDEX "AttendancePunch_attendanceId_idx" ON "AttendancePunch"("attendanceId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
