add sql scripts
This commit is contained in:
parent
d2f158c614
commit
9953add43c
90
setup.sql
Normal file
90
setup.sql
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
create table {prefix}_meta_permission
|
||||||
|
(
|
||||||
|
permission_level integer primary key,
|
||||||
|
name varchar(10)
|
||||||
|
);
|
||||||
|
insert into {prefix}_meta_permission values (0,'超级管理员'),(1,'管理员'),(2,'图书馆借阅处'),(3,'读者');
|
||||||
|
|
||||||
|
|
||||||
|
create table {prefix}_meta_account
|
||||||
|
(
|
||||||
|
account_status integer primary key,
|
||||||
|
name varchar(10)
|
||||||
|
);
|
||||||
|
insert into {prefix}_meta_account values (0,'隐藏'),(1,'禁止登陆'),(2,'待验证'),(3,'正常');
|
||||||
|
|
||||||
|
create table {prefix}_meta_book
|
||||||
|
(
|
||||||
|
status integer primary key,
|
||||||
|
name varchar(10)
|
||||||
|
);
|
||||||
|
insert into {prefix}_meta_book values (0,'隐藏'),(1,'禁用'),(2,'正常');
|
||||||
|
|
||||||
|
create table {prefix}_meta_bookstatus
|
||||||
|
(
|
||||||
|
status integer primary key,
|
||||||
|
name varchar(10)
|
||||||
|
);
|
||||||
|
insert into {prefix}_meta_bookstatus values (0,'借出'),(1,'丢失'),(2,'在馆');
|
||||||
|
|
||||||
|
create table {prefix}_user
|
||||||
|
(
|
||||||
|
username varchar(10) primary key,
|
||||||
|
password char(32),
|
||||||
|
nickname varchar(10),
|
||||||
|
permission_level integer references {prefix}_meta_permission(permission_level),
|
||||||
|
account_status integer references {prefix}_meta_account(account_status)
|
||||||
|
);
|
||||||
|
create table {prefix}_level
|
||||||
|
(
|
||||||
|
user_lv integer primary key,
|
||||||
|
min_amount_limit integer,
|
||||||
|
max_amount_limit integer,
|
||||||
|
min_time_limit integer,
|
||||||
|
max_time_limit integer,
|
||||||
|
min_balance decimal(10,2)
|
||||||
|
);
|
||||||
|
create table {prefix}_reader
|
||||||
|
(
|
||||||
|
username varchar(10) references {prefix}_user(username),
|
||||||
|
realname varchar(10),
|
||||||
|
realid char(18),
|
||||||
|
phonenum varchar(15),
|
||||||
|
user_lv integer references {prefix}_level(user_lv),
|
||||||
|
user_exp integer,
|
||||||
|
borrow_limit integer,
|
||||||
|
borrow_used integer,
|
||||||
|
borrow_time_limit integer,
|
||||||
|
bonus integer,
|
||||||
|
balance decimal(10,2)
|
||||||
|
);
|
||||||
|
create table {prefix}_booktype
|
||||||
|
(
|
||||||
|
book_type varchar(10) primary key
|
||||||
|
);
|
||||||
|
create table {prefix}_book
|
||||||
|
(
|
||||||
|
class_id varchar(20) primary key,
|
||||||
|
isbn varchar(13) unique,
|
||||||
|
name varchar(20),
|
||||||
|
book_type varchar(10) references {prefix}_booktype(book_type),
|
||||||
|
author varchar(10),
|
||||||
|
publisher varchar(20),
|
||||||
|
publish_time date,
|
||||||
|
status integer references {prefix}_meta_book(status)
|
||||||
|
);
|
||||||
|
create table {prefix}_bookstatus
|
||||||
|
(
|
||||||
|
book_id varchar(25) primary key,
|
||||||
|
class_id varchar(20) references {prefix}_book(class_id),
|
||||||
|
position varchar(30),
|
||||||
|
status integer references {prefix}_meta_bookstatus(status)
|
||||||
|
);
|
||||||
|
create table {prefix}_borrow
|
||||||
|
(
|
||||||
|
username varchar(10) references {prefix}_user(username),
|
||||||
|
book_id varchar(25) references {prefix}_bookstatus(book_id),
|
||||||
|
borrow_time date not null,
|
||||||
|
return_deadline date not null,
|
||||||
|
return_time date
|
||||||
|
);
|
Reference in New Issue
Block a user