59 lines
2.0 KiB
SQL
59 lines
2.0 KiB
SQL
drop table if exists `user`
|
|
|
|
create table user
|
|
(
|
|
id int unsigned auto_increment
|
|
primary key,
|
|
create_time datetime null,
|
|
update_time datetime null,
|
|
username varchar(100) not null,
|
|
password varchar(255) not null,
|
|
nickname varchar(100) null
|
|
)
|
|
comment '用户表';
|
|
|
|
|
|
|
|
drop table if exists `goal`;
|
|
|
|
CREATE TABLE if not exists `goal`
|
|
(
|
|
id INT unsigned auto_increment PRIMARY KEY,
|
|
status enum ('DOING', 'DONE', 'CANCEL') default 'DOING' not null,
|
|
create_time DATETIME NULL,
|
|
update_time DATETIME NULL,
|
|
type enum ('GOAL', 'TASK', 'HABIT') default 'TASK' NOT NULL,
|
|
name varchar(100) NOT NULL,
|
|
tag varchar(100) NULL,
|
|
detail varchar(100) NULL,
|
|
root_id int unsigned null,
|
|
parent_id int unsigned null
|
|
)
|
|
COMMENT ='目标管理表';
|
|
|
|
drop table if exists `habit_record`;
|
|
|
|
create table habit_record
|
|
(
|
|
id int unsigned auto_increment
|
|
primary key,
|
|
create_time datetime null,
|
|
update_time datetime null,
|
|
goal_id int unsigned not null
|
|
)
|
|
comment '习惯记录表';
|
|
|
|
drop table if exists `anniversary`
|
|
|
|
create table `anniversary`
|
|
(
|
|
id int unsigned auto_increment,
|
|
create_time datetime null,
|
|
update_time datetime null,
|
|
name varchar(100) not null,
|
|
date date not null comment '重要的日期',
|
|
type enum ('ANNIVERSARY', 'COMMEMORATION') default 'ANNIVERSARY' not null
|
|
)
|
|
comment '周年纪念日';
|
|
|