[
  {
    "type": "create_table",
    "description": "Create billingSmsUsage table for SMS usage tracking",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'billingSmsUsage'",
    "sql": "CREATE TABLE `billingSmsUsage` (`id` bigint unsigned NOT NULL AUTO_INCREMENT, `typeNum` varchar(10) NOT NULL COMMENT 'Store identifier', `smsCategory` enum('buy_completion','service_completion','survey','chat_transactional','chat_interactive','marketing','custom') NOT NULL, `segmentCount` tinyint unsigned NOT NULL DEFAULT 1, `provider` enum('twilio','vonage') NOT NULL, `providerMessageId` varchar(255) DEFAULT NULL, `direction` enum('outbound','inbound') NOT NULL DEFAULT 'outbound', `billable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Snapshotted at send time from store config', `status` enum('success','failed') NOT NULL DEFAULT 'success', `billingPeriod` varchar(7) NOT NULL COMMENT 'YYYY-MM format', `sentAt` datetime NOT NULL, `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `idx_typenum_period` (`typeNum`, `billingPeriod`), KEY `idx_period_category` (`billingPeriod`, `smsCategory`), KEY `idx_typenum_category_period` (`typeNum`, `smsCategory`, `billingPeriod`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='SMS usage tracking for billing'"
  }
]
