-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_OrgSettings" (
    "id" TEXT NOT NULL PRIMARY KEY DEFAULT 'singleton',
    "name" TEXT NOT NULL DEFAULT 'Colour Club Studio',
    "legalName" TEXT NOT NULL DEFAULT '',
    "industry" TEXT NOT NULL DEFAULT 'Textile / Garments',
    "address" TEXT NOT NULL DEFAULT '',
    "city" TEXT NOT NULL DEFAULT 'Lahore',
    "phone" TEXT NOT NULL DEFAULT '',
    "email" TEXT NOT NULL DEFAULT '',
    "website" TEXT NOT NULL DEFAULT '',
    "ntn" TEXT NOT NULL DEFAULT '',
    "eobi" TEXT NOT NULL DEFAULT '',
    "pessi" TEXT NOT NULL DEFAULT '',
    "workingHours" TEXT NOT NULL DEFAULT '8',
    "workingDays" TEXT NOT NULL DEFAULT '6',
    "dutyStart" TEXT NOT NULL DEFAULT '09:00',
    "dutyEnd" TEXT NOT NULL DEFAULT '17:00',
    "breakMinutes" INTEGER NOT NULL DEFAULT 0,
    "departments" TEXT NOT NULL DEFAULT 'Production,Quality Control,HR,Finance,Management',
    "designations" TEXT NOT NULL DEFAULT 'Manager,Supervisor,Operator,Assistant,Intern',
    "holidayDates" TEXT,
    "eobiEmployerRate" REAL NOT NULL DEFAULT 0,
    "eobiEmployeeRate" REAL NOT NULL DEFAULT 0,
    "pessiEmployerRate" REAL NOT NULL DEFAULT 0,
    "pessiEmployeeRate" REAL NOT NULL DEFAULT 0,
    "holidayCalendar" TEXT NOT NULL DEFAULT '[]',
    "shifts" TEXT NOT NULL DEFAULT '[]',
    "minimumWage" REAL NOT NULL DEFAULT 40000,
    "smtpHost" TEXT NOT NULL DEFAULT '',
    "smtpPort" TEXT NOT NULL DEFAULT '587',
    "smtpSecure" BOOLEAN NOT NULL DEFAULT false,
    "smtpUser" TEXT NOT NULL DEFAULT '',
    "smtpPassword" TEXT NOT NULL DEFAULT '',
    "fromEmail" TEXT NOT NULL DEFAULT '',
    "fromName" TEXT NOT NULL DEFAULT '',
    "enableOnboardingEmail" BOOLEAN NOT NULL DEFAULT true,
    "enableSalaryEmail" BOOLEAN NOT NULL DEFAULT true,
    "enableAttendanceEmail" BOOLEAN NOT NULL DEFAULT false,
    "enableLeaveEmail" BOOLEAN NOT NULL DEFAULT true,
    "updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_OrgSettings" ("address", "breakMinutes", "city", "departments", "designations", "dutyEnd", "dutyStart", "email", "eobi", "eobiEmployeeRate", "eobiEmployerRate", "holidayCalendar", "holidayDates", "id", "industry", "legalName", "name", "ntn", "pessi", "pessiEmployeeRate", "pessiEmployerRate", "phone", "updatedAt", "website", "workingDays", "workingHours") SELECT "address", "breakMinutes", "city", "departments", "designations", "dutyEnd", "dutyStart", "email", "eobi", "eobiEmployeeRate", "eobiEmployerRate", "holidayCalendar", "holidayDates", "id", "industry", "legalName", "name", "ntn", "pessi", "pessiEmployeeRate", "pessiEmployerRate", "phone", "updatedAt", "website", "workingDays", "workingHours" FROM "OrgSettings";
DROP TABLE "OrgSettings";
ALTER TABLE "new_OrgSettings" RENAME TO "OrgSettings";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
