20260826_add_merchant_business_time.sql 721 B

123456789101112131415161718192021
  1. -- ============================================================
  2. -- 商户营业时间
  3. -- 日期: 2026-08-26
  4. -- 说明: 兼容旧系统 business_time_des 展示文本字段。
  5. -- ============================================================
  6. SET @column_exists = (
  7. SELECT COUNT(*)
  8. FROM information_schema.COLUMNS
  9. WHERE TABLE_SCHEMA = DATABASE()
  10. AND TABLE_NAME = 'sa_merchant'
  11. AND COLUMN_NAME = 'business_time_des'
  12. );
  13. SET @sql = IF(
  14. @column_exists = 0,
  15. 'ALTER TABLE `sa_merchant` ADD COLUMN `business_time_des` VARCHAR(64) NOT NULL DEFAULT ''09:00-22:00'' COMMENT ''营业时间展示文本'' AFTER `address`',
  16. 'SELECT 1'
  17. );
  18. PREPARE stmt FROM @sql;
  19. EXECUTE stmt;
  20. DEALLOCATE PREPARE stmt;