mex_warehouse.sql 1.4 KB

12345678910111213141516171819202122
  1. -- ******************************************************************
  2. -- 表 kku_mex_warehouse 的创建SQL
  3. -- 对应的Model: App\Module\Mex\Models\MexWarehouse
  4. -- 警告: 此文件由系统自动生成,禁止修改!
  5. -- ******************************************************************
  6. CREATE TABLE `kku_mex_warehouse` (
  7. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '记录ID,主键',
  8. `item_id` int(11) NOT NULL COMMENT '商品ID,关联物品表',
  9. `quantity` int(11) NOT NULL DEFAULT '0' COMMENT '库存数量',
  10. `total_buy_amount` decimal(20,5) DEFAULT '0.00000' COMMENT '累计买入金额',
  11. `total_sell_amount` decimal(20,5) DEFAULT '0.00000' COMMENT '累计卖出金额',
  12. `total_buy_quantity` int(11) DEFAULT '0' COMMENT '累计买入数量',
  13. `total_sell_quantity` int(11) DEFAULT '0' COMMENT '累计卖出数量',
  14. `last_transaction_at` timestamp NULL DEFAULT NULL COMMENT '最后交易时间',
  15. `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  16. `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  17. PRIMARY KEY (`id`) USING BTREE,
  18. UNIQUE KEY `uk_item_id` (`item_id`) USING BTREE,
  19. KEY `idx_quantity` (`quantity`) USING BTREE,
  20. KEY `idx_last_transaction_at` (`last_transaction_at`) USING BTREE
  21. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='农贸市场系统仓库表';