[
  {
    "type": "create_table",
    "description": "Create daybook_task_lists table for task list configuration",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_task_lists'",
    "sql": "CREATE TABLE `daybook_task_lists` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `groupId` int(10) unsigned NOT NULL COMMENT 'FK to taskGroups.id',\n  `displayName` varchar(100) DEFAULT NULL,\n  `scheduledDays` varchar(60) DEFAULT 'SUN MON TUE WED THU FRI SAT',\n  `startTime` time DEFAULT NULL COMMENT 'When this list becomes active on daybook',\n  `sortOrder` int(10) unsigned DEFAULT 0,\n  `isActive` tinyint(1) unsigned DEFAULT 1,\n  PRIMARY KEY (`id`),\n  KEY `idx_groupId` (`groupId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Daybook task list configuration'"
  },
  {
    "type": "create_table",
    "description": "Create daybook_task_assignments table for task employee assignments",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_task_assignments'",
    "sql": "CREATE TABLE `daybook_task_assignments` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `taskId` int(10) unsigned NOT NULL,\n  `employeeId` int(10) unsigned DEFAULT NULL COMMENT 'NULL = assigned to all',\n  `dueDate` date DEFAULT NULL,\n  `dueTime` time DEFAULT NULL,\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `createdBy` int(10) unsigned DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  KEY `idx_taskId` (`taskId`),\n  KEY `idx_employeeId` (`employeeId`),\n  KEY `idx_dueDate` (`dueDate`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Task assignments to employees'"
  },
  {
    "type": "create_table",
    "description": "Create daybook_task_completions table for daily task tracking",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_task_completions'",
    "sql": "CREATE TABLE `daybook_task_completions` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `taskId` int(10) unsigned NOT NULL,\n  `date` date NOT NULL,\n  `status` tinyint(1) unsigned DEFAULT 0 COMMENT '0=Not Started, 1=In Progress, 2=Completed',\n  `completedBy` int(10) unsigned DEFAULT NULL,\n  `completedAt` timestamp NULL DEFAULT NULL,\n  `notes` text DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_task_date` (`taskId`, `date`),\n  KEY `idx_date` (`date`),\n  KEY `idx_status` (`status`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Daily task completion tracking'"
  },
  {
    "type": "create_table",
    "description": "Create daybook_task_comments table for task comments",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_task_comments'",
    "sql": "CREATE TABLE `daybook_task_comments` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `taskId` int(10) unsigned NOT NULL,\n  `date` date NOT NULL COMMENT 'The day this comment relates to',\n  `employeeId` int(10) unsigned NOT NULL,\n  `comment` text NOT NULL,\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_taskId_date` (`taskId`, `date`),\n  KEY `idx_employeeId` (`employeeId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Comments on daily tasks'"
  }
]
