[
  {
    "type": "create_table",
    "description": "Create qb_store_settings table for per-store QuickBooks configuration",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'qb_store_settings'",
    "sql": "CREATE TABLE `qb_store_settings` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `settingKey` VARCHAR(100) NOT NULL,\n  `settingValue` TEXT NULL,\n  `updatedAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  `updatedBy` INT UNSIGNED NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_setting_key` (`settingKey`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Per-store QuickBooks settings (Spec 048)'"
  },
  {
    "type": "insert",
    "description": "Seed default QuickBooks settings for qb_store_settings",
    "database": "{{store}}",
    "check_query": "SELECT id FROM qb_store_settings WHERE settingKey = 'syncMode' LIMIT 1",
    "sql": "INSERT INTO `qb_store_settings` (`settingKey`, `settingValue`) VALUES\n  ('syncMode', 'manual'),\n  ('syncCadence', 'daily'),\n  ('updateBehavior', 'manual_decision'),\n  ('memoTemplate', 'Daily Sales - {companyName} ({typeNum}) - {date}'),\n  ('reminderDays', '3'),\n  ('lastReconciled', NULL)"
  }
]
