1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| CREATE DATABASE IF NOT EXISTS `hmily` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE DATABASE IF NOT EXISTS `hmily_account` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; USE `hmily_account`; DROP TABLE IF EXISTS `account`; CREATE TABLE `account` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `user_id` varchar(128) NOT NULL, `balance` decimal(10,0) NOT NULL COMMENT '用户余额', `freeze_amount` decimal(10,0) NOT NULL COMMENT '冻结金额,扣款暂存余额', `create_time` datetime NOT NULL, `update_time` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; insert into `account`(`id`,`user_id`,`balance`,`freeze_amount`,`create_time`,`update_time`) values (1,'10000', 10000000,0,'2017-09-18 14:54:22',NULL);
CREATE DATABASE IF NOT EXISTS `hmily_stock` DEFAULT CHARACTER SET utf8mb4; USE `hmily_stock`; DROP TABLE IF EXISTS `inventory`; CREATE TABLE `inventory` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `product_id` VARCHAR(128) NOT NULL, `total_inventory` int(10) NOT NULL COMMENT '总库存', `lock_inventory` int(10) NOT NULL COMMENT '锁定库存', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; insert into `inventory`(`id`,`product_id`,`total_inventory`,`lock_inventory`) values (1,'1',10000000,0);
CREATE DATABASE IF NOT EXISTS `hmily_order` DEFAULT CHARACTER SET utf8mb4; USE `hmily_order`; DROP TABLE IF EXISTS `order`; CREATE TABLE `order` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `create_time` datetime NOT NULL, `number` varchar(20) COLLATE utf8mb4_bin NOT NULL, `status` tinyint(4) NOT NULL, `product_id` varchar(128) NOT NULL, `total_amount` decimal(10,0) NOT NULL, `count` int(4) NOT NULL, `user_id` varchar(128) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|