[
  {
    "type": "alter_table",
    "description": "Add eventId column to workbook_notes for event management integration",
    "database": "{{store}}",
    "check_query": "SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'workbook_notes' AND COLUMN_NAME = 'eventId' LIMIT 1",
    "sql": "ALTER TABLE workbook_notes ADD COLUMN eventId INT(10) UNSIGNED NULL DEFAULT NULL COMMENT 'FK to events.id - marks note as event-managed' AFTER isPinned"
  },
  {
    "type": "alter_table",
    "description": "Add index on eventId for faster event-related queries",
    "database": "{{store}}",
    "check_query": "SELECT INDEX_NAME FROM information_schema.STATISTICS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'workbook_notes' AND INDEX_NAME = 'idx_eventId' LIMIT 1",
    "sql": "ALTER TABLE workbook_notes ADD INDEX idx_eventId (eventId)"
  }
]
