mex_transactions.sql 2.3 KB

1234567891011121314151617181920212223242526272829303132
  1. -- ******************************************************************
  2. -- 表 kku_mex_transactions 的创建SQL
  3. -- 对应的Model: App\Module\Mex\Models\MexTransaction
  4. -- 警告: 此文件由系统自动生成,禁止修改!
  5. -- ******************************************************************
  6. CREATE TABLE `kku_mex_transactions` (
  7. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '成交记录ID,主键',
  8. `buy_order_id` bigint(20) DEFAULT NULL COMMENT '买单ID,关联mex_orders表',
  9. `sell_order_id` bigint(20) DEFAULT NULL COMMENT '卖单ID,关联mex_orders表',
  10. `buyer_id` bigint(20) NOT NULL COMMENT '买方用户ID',
  11. `seller_id` bigint(20) NOT NULL COMMENT '卖方用户ID',
  12. `item_id` int(11) NOT NULL COMMENT '商品ID,关联物品表',
  13. `currency_type` int(11) NOT NULL DEFAULT '2' COMMENT '币种类型,关联FUND_CURRENCY_TYPE枚举,默认2为钻石',
  14. `quantity` int(11) NOT NULL COMMENT '成交数量',
  15. `price` decimal(25,9) NOT NULL COMMENT '成交价格',
  16. `total_amount` decimal(25,9) NOT NULL COMMENT '成交总金额',
  17. `transaction_type` enum('USER_SELL','USER_BUY','ADMIN_INJECT','ADMIN_RECYCLE') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易类型:USER_SELL用户卖出,USER_BUY用户买入,ADMIN_INJECT管理员注入,ADMIN_RECYCLE管理员回收',
  18. `is_admin_operation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否管理员操作:0否,1是',
  19. `admin_user_id` bigint(20) DEFAULT NULL COMMENT '管理员用户ID(管理员操作时使用)',
  20. `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '成交时间',
  21. PRIMARY KEY (`id`) USING BTREE,
  22. KEY `idx_buy_order_id` (`buy_order_id`) USING BTREE,
  23. KEY `idx_sell_order_id` (`sell_order_id`) USING BTREE,
  24. KEY `idx_buyer_id` (`buyer_id`) USING BTREE,
  25. KEY `idx_seller_id` (`seller_id`) USING BTREE,
  26. KEY `idx_item_id` (`item_id`) USING BTREE,
  27. KEY `idx_transaction_type` (`transaction_type`) USING BTREE,
  28. KEY `idx_created_at` (`created_at`) USING BTREE,
  29. KEY `idx_is_admin_operation` (`is_admin_operation`) USING BTREE,
  30. KEY `idx_currency_type` (`currency_type`) USING BTREE COMMENT '币种类型索引'
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='农贸市场成交记录表';