-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
90 lines (80 loc) · 1.69 KB
/
init.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
create schema stack collate utf8mb4_unicode_ci;
create table operation
(
id int auto_increment
primary key,
operation_code varchar(32) not null,
operation_desc varchar(255) not null,
constraint operation_operation_code_uindex
unique (operation_code)
);
create table org
(
id int auto_increment
primary key,
org_name varchar(255) not null,
level int not null,
parent_id int not null
);
create table role
(
id int auto_increment
primary key,
role_name varchar(32) not null,
constraint role_role_name_uindex
unique (role_name)
);
create table role_operation
(
id int auto_increment
primary key,
operation_id int not null,
role_id int not null,
constraint role_operation_operation_id_role_id_uindex
unique (operation_id, role_id)
);
create table store
(
id int auto_increment
primary key,
store_name varchar(255) not null,
org_id int not null
);
create table user
(
id int auto_increment
primary key,
username varchar(32) not null,
password varchar(255) not null,
nickname varchar(255) not null,
constraint user_username_uindex
unique (username)
);
create table user_org
(
id int auto_increment
primary key,
org_id int not null,
user_id int not null,
constraint user_org_org_id_user_id_uindex
unique (org_id, user_id)
);
create table user_role
(
id int auto_increment
primary key,
role_id int not null,
user_id int not null,
constraint user_role_role_id_user_id_uindex
unique (role_id, user_id)
);
create table doc_counter
(
id int auto_increment comment '主键'
primary key,
doc_type varchar(16) null comment '单据类型',
count bigint not null comment '计数器',
constraint doc_counter_doc_type_uindex
unique (doc_type)
)
comment '单据号计数器表';