-- ******************************************************************
-- 表 kku_team_referral_changes 的创建SQL
-- 对应的Model: App\Module\Team\Models\TeamReferralChange
-- 警告: 此文件由系统自动生成，禁止修改！
-- ******************************************************************

CREATE TABLE `kku_team_referral_changes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `old_referrer_id` bigint DEFAULT NULL COMMENT '旧推荐人ID',
  `new_referrer_id` bigint NOT NULL COMMENT '新推荐人ID',
  `change_time` timestamp NOT NULL COMMENT '修改时间',
  `change_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '修改原因',
  `changed_by` bigint NOT NULL COMMENT '操作人ID',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE,
  KEY `idx_change_time` (`change_time`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='推荐关系修改记录表';
