forked from sofastack-guides/kc-sofastack-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDDL.sql
44 lines (42 loc) · 1.23 KB
/
DDL.sql
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
# ==========================
# balance db
CREATE DATABASE balance_db;
USE balance_db;
DROP TABLE IF EXISTS `balance_tb`;
CREATE TABLE `balance_tb`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(255) DEFAULT NULL,
`balance` decimal(16, 2) DEFAULT 0.00,
PRIMARY KEY (`id`),
UNIQUE KEY (`user_name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
# ==========================
# stock db
CREATE database stock_db;
USE stock_db;
DROP TABLE IF EXISTS `stock_tb`;
CREATE TABLE `stock_tb`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_code` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`description` text,
`price` decimal(10, 2) DEFAULT 0.00,
`count` int(11) DEFAULT 0,
`user_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`id`, `user_name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
DROP TABLE IF EXISTS `order_tb`;
CREATE TABLE `order_tb`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(255) DEFAULT NULL,
`product_code` varchar(255) DEFAULT NULL,
`count` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;