[
  {
    "type": "create_table",
    "description": "Create daybook_notes table for notes/announcements system",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_notes'",
    "sql": "CREATE TABLE `daybook_notes` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `authorEmployeeId` int(10) unsigned NOT NULL,\n  `title` varchar(255) DEFAULT NULL,\n  `content` text NOT NULL,\n  `contentHtml` text DEFAULT NULL COMMENT 'Rich text HTML content',\n  `startDate` date NOT NULL COMMENT 'First day note is visible',\n  `endDate` date DEFAULT NULL COMMENT 'Last day note is visible (NULL = indefinite)',\n  `isManagerOnly` tinyint(1) unsigned DEFAULT 0,\n  `isPinned` tinyint(1) unsigned DEFAULT 0,\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  KEY `idx_visibility` (`startDate`, `endDate`, `isManagerOnly`),\n  KEY `idx_authorEmployeeId` (`authorEmployeeId`),\n  KEY `idx_isPinned` (`isPinned`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Daybook notes and announcements'"
  },
  {
    "type": "create_table",
    "description": "Create daybook_note_reactions table for note likes/reactions",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_note_reactions'",
    "sql": "CREATE TABLE `daybook_note_reactions` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `noteId` int(10) unsigned NOT NULL,\n  `employeeId` int(10) unsigned NOT NULL,\n  `reactionType` varchar(20) DEFAULT 'like',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_note_employee` (`noteId`, `employeeId`),\n  KEY `idx_noteId` (`noteId`),\n  KEY `idx_employeeId` (`employeeId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Reactions on daybook notes'"
  },
  {
    "type": "create_table",
    "description": "Create daybook_note_comments table for comments on notes",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'daybook_note_comments'",
    "sql": "CREATE TABLE `daybook_note_comments` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `noteId` int(10) unsigned NOT NULL,\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_noteId` (`noteId`),\n  KEY `idx_employeeId` (`employeeId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Comments on daybook notes'"
  }
]
