[
  {
    "type": "create_table",
    "description": "Create analytics_seller_cohorts table for seller retention tracking",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'analytics_seller_cohorts'",
    "sql": "CREATE TABLE `analytics_seller_cohorts` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cohortMonth` date NOT NULL COMMENT 'First of month - cohort identifier', `analysisDate` date NOT NULL COMMENT 'Date of analysis', `newSellers` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Sellers who joined in cohort month', `activeSellers` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Sellers active in analysis period', `retentionRate` decimal(5,2) DEFAULT 0 COMMENT 'Percent retained', `avgContainersPerVisit` decimal(6,2) DEFAULT 0 COMMENT 'Average containers per visit', `avgVisitsPerSeller` decimal(6,2) DEFAULT 0 COMMENT 'Average visits per seller', `computedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `unique_cohort_analysis` (`cohortMonth`, `analysisDate`), KEY `idx_analysis_date` (`analysisDate`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Seller cohort retention tracking for analytics'"
  }
]
