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

CREATE TABLE `kku_fund_logs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT '用户ID',
  `fund_id` int NOT NULL COMMENT '资金id',
  `amount` decimal(30,10) NOT NULL COMMENT '操作金额,正值为收入,负值为支出',
  `operate_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '上游操作id',
  `operate_type` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '上游操作类型',
  `remark` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '备注',
  `create_time` int NOT NULL DEFAULT '0' COMMENT '最后更新时间',
  `create_ip` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '最后更新ip',
  `later_balance` decimal(30,10) NOT NULL COMMENT '在此之后的余额',
  `before_balance` decimal(30,10) NOT NULL COMMENT '在此之前的余额',
  `date_key` int NOT NULL COMMENT '月份key',
  `hash` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '防篡改哈希值',
  `prev_hash` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '上一条记录的哈希值',
  PRIMARY KEY (`id`,`date_key`) USING BTREE,
  KEY `lan_fund_log_fund_id_IDX` (`fund_id`,`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='资金日志';
