-- ----------------------------
-- by AI
-- ----------------------------

-- 创建销售区域表
CREATE TABLE `sales_region` (
  `region_id` bigint NOT NULL AUTO_INCREMENT COMMENT '销售区域ID',
  `region_name` varchar(100) NOT NULL COMMENT '销售区域名称',
  `country_id` int NOT NULL COMMENT '国家ID',
  `user_id` bigint NOT NULL COMMENT '负责用户ID',
  `status` char(1) DEFAULT '0' COMMENT '状态（0正常 1停用）',
  `del_flag` char(1) DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) DEFAULT '' COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`region_id`),
  KEY `idx_country_id` (`country_id`),
  KEY `idx_user_id` (`user_id`),
  CONSTRAINT `fk_sales_region_country` FOREIGN KEY (`country_id`) REFERENCES `iso3166_country` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_sales_region_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='销售区域表';