Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dankal-data-view
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
仲光辉
dankal-data-view
Commits
e1ea6338
Commit
e1ea6338
authored
Nov 21, 2024
by
mercymodest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:- add sql
parent
8b8a46fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
58 deletions
+69
-58
2024-11-07-update.sql
电子日历/2024-11-07-update.sql
+69
-58
No files found.
电子日历/2024-11-07-update.sql
View file @
e1ea6338
alter
table
t_events
alter
table
t_events
...
...
@@ -8,29 +8,29 @@ create index t_event_category_relations_event_id_index
on
t_event_category_relations
(
event_id
);
-- 创建杂物完成记录表
CREATE
TABLE
t_misc_event_records
(
CREATE
TABLE
t_misc_event_records
(
-- 主键 ID,使用自增
misc_event_record_id
BIGINT
NOT
NULL
,
misc_event_record_id
BIGINT
NOT
NULL
,
-- 设备 ID
device_id
BIGINT
NOT
NULL
COMMENT
'设备ID'
,
device_id
BIGINT
NOT
NULL
COMMENT
'设备ID'
,
-- 事件 ID
origin_event_id
BIGINT
NOT
NULL
COMMENT
'事件ID'
,
origin_event_id
BIGINT
NOT
NULL
COMMENT
'事件ID'
,
start_datetime
datetime
null
comment
'事项开始时间(UTC+0)'
,
start_date
date
null
comment
'开始日期'
,
start_time
time
null
comment
'开始时间'
,
end_datetime
datetime
null
comment
'事项结束时间(UTC+0)'
,
end_date
date
null
comment
'结束日期'
,
end_time
time
null
comment
'结束时间'
,
start_datetime
datetime
null
comment
'事项开始时间(UTC+0)'
,
start_date
date
null
comment
'开始日期'
,
start_time
time
null
comment
'开始时间'
,
end_datetime
datetime
null
comment
'事项结束时间(UTC+0)'
,
end_date
date
null
comment
'结束日期'
,
end_time
time
null
comment
'结束时间'
,
completed_time
DATETIME
NOT
NULL
COMMENT
'杂物完成时间'
,
completed_time
DATETIME
NOT
NULL
COMMENT
'杂物完成时间'
,
create_time
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
update_time
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
create_time
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
update_time
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
-- 主键约束
PRIMARY
KEY
(
misc_event_record_id
),
...
...
@@ -38,71 +38,76 @@ CREATE TABLE t_misc_event_records (
-- 索引
INDEX
idx_device_id
(
device_id
),
INDEX
idx_origin_event_id
(
origin_event_id
),
INDEX
idc_start_datetime
(
start_datetime
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'杂物完成记录表'
;
INDEX
idc_start_datetime
(
start_datetime
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'杂物完成记录表'
;
create
index
sys_oper_log_title_index
on
sys_oper_log
(
title
);
-- 创建第三方日历授权信息表
CREATE
TABLE
`t_third_party_calendar_auth`
(
`third_party_calendar_auth_id`
BIGINT
NOT
NULL
COMMENT
'主键'
,
`user_id`
BIGINT
NOT
NULL
COMMENT
'用户id'
,
CREATE
TABLE
`t_third_party_calendar_auth`
(
`third_party_calendar_auth_id`
BIGINT
NOT
NULL
COMMENT
'主键'
,
`user_id`
BIGINT
NOT
NULL
COMMENT
'用户id'
,
-- 授权邮箱
`email`
VARCHAR
(
255
)
NOT
NULL
COMMENT
'授权邮箱'
,
`email`
VARCHAR
(
255
)
NOT
NULL
COMMENT
'授权邮箱'
,
-- source_type 0:google 1:outlook
`source_type`
TINYINT
NOT
NULL
COMMENT
'第三方日历类型 0:google 1:outlook'
,
`source_type`
TINYINT
NOT
NULL
COMMENT
'第三方日历类型 0:google 1:outlook'
,
-- access_token
`access_token`
TEXT
NOT
NULL
COMMENT
'访问令牌'
,
`access_token`
TEXT
NOT
NULL
COMMENT
'访问令牌'
,
-- access_token_expires_in
`access_token_expires_in`
datetime
NULL
COMMENT
'访问令牌过期时间'
,
`access_token_expires_in`
datetime
NULL
COMMENT
'访问令牌过期时间'
,
-- refresh_token
`refresh_token`
TEXT
NULL
COMMENT
'刷新令牌'
,
`refresh_token`
TEXT
NULL
COMMENT
'刷新令牌'
,
-- refresh_token_expires_in
`refresh_token_expires_in`
datetime
NULL
COMMENT
'刷新令牌过期时间'
,
`refresh_token_expires_in`
datetime
NULL
COMMENT
'刷新令牌过期时间'
,
-- scope
`scope`
TEXT
NULL
COMMENT
'授权范围'
,
`scope`
TEXT
NULL
COMMENT
'授权范围'
,
-- auth_code
`auth_code`
TEXT
NULL
COMMENT
'授权码'
,
`auth_code`
TEXT
NULL
COMMENT
'授权码'
,
-- id_token
`id_token`
TEXT
NULL
COMMENT
'id_token'
,
`id_token`
TEXT
NULL
COMMENT
'id_token'
,
-- is_two_way_sync tinyint default 0 null comment '是否双向同步 0:否 1:是 default:0',
`is_two_way_sync`
TINYINT
default
0
null
comment
'是否双向同步 0:否 1:是 default:0'
,
`create_time`
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
`update_time`
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
`is_two_way_sync`
TINYINT
default
0
null
comment
'是否双向同步 0:否 1:是 default:0'
,
`create_time`
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
`update_time`
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
PRIMARY
KEY
(
`third_party_calendar_auth_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'第三方日历授权信息表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'第三方日历授权信息表'
;
CREATE
INDEX
`idx_user_id_email`
ON
`t_third_party_calendar_auth`
(
`user_id`
,
`email`
);
CREATE
INDEX
`idx_email`
ON
`t_third_party_calendar_auth`
(
`email`
);
-- 第三方授权日历列表
CREATE
TABLE
`t_third_party_calendar_list`
(
`third_party_calendar_list_id`
BIGINT
NOT
NULL
COMMENT
'主键'
,
`third_party_calendar_auth_id`
BIGINT
NOT
NULL
COMMENT
't_third_party_calendar_auth 第三方日历授权id'
,
`email`
VARCHAR
(
255
)
NOT
NULL
COMMENT
'授权邮箱'
,
`calendar_id`
VARCHAR
(
200
)
NOT
NULL
COMMENT
'日历id'
,
`calendar_name`
VARCHAR
(
255
)
NOT
NULL
COMMENT
'日历名称'
,
CREATE
TABLE
`t_third_party_calendar_list`
(
`third_party_calendar_list_id`
BIGINT
NOT
NULL
COMMENT
'主键'
,
`third_party_calendar_auth_id`
BIGINT
NOT
NULL
COMMENT
't_third_party_calendar_auth 第三方日历授权id'
,
`email`
VARCHAR
(
255
)
NOT
NULL
COMMENT
'授权邮箱'
,
`calendar_id`
VARCHAR
(
200
)
NOT
NULL
COMMENT
'日历id'
,
`calendar_name`
VARCHAR
(
255
)
NOT
NULL
COMMENT
'日历名称'
,
-- 是否主日历 0:否 1:是 default:0
`is_primary`
TINYINT
default
0
null
comment
'是否主日历 0:否 1:是 default:0'
,
`is_primary`
TINYINT
default
0
null
comment
'是否主日历 0:否 1:是 default:0'
,
-- 是否同步 0:否 1:是 default:0
`is_sync`
TINYINT
default
0
null
comment
'是否同步 0:否 1:是 default:0'
,
`is_sync`
TINYINT
default
0
null
comment
'是否同步 0:否 1:是 default:0'
,
-- timeZone 时区
`time_zone`
VARCHAR
(
150
)
NULL
COMMENT
'时区'
,
`time_zone`
VARCHAR
(
150
)
NULL
COMMENT
'时区'
,
-- kind
`kind`
VARCHAR
(
200
)
NULL
COMMENT
'kind'
,
`kind`
VARCHAR
(
200
)
NULL
COMMENT
'kind'
,
-- foregroundColor
`foreground_color`
VARCHAR
(
50
)
NULL
COMMENT
'前景色'
,
`foreground_color`
VARCHAR
(
50
)
NULL
COMMENT
'前景色'
,
-- backgroundColor
`background_color`
VARCHAR
(
50
)
NULL
COMMENT
'背景色'
,
`background_color`
VARCHAR
(
50
)
NULL
COMMENT
'背景色'
,
-- 原始JSON数据
`raw_json`
TEXT
NULL
COMMENT
'原始JSON数据'
,
`create_time`
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
`update_time`
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
`raw_json`
TEXT
NULL
COMMENT
'原始JSON数据'
,
`create_time`
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
`update_time`
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
PRIMARY
KEY
(
`third_party_calendar_list_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'第三方授权日历列表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'第三方授权日历列表'
;
CREATE
INDEX
`idx_third_party_calendar_auth_id`
ON
`t_third_party_calendar_list`
(
`third_party_calendar_auth_id`
);
...
...
@@ -112,17 +117,19 @@ CREATE INDEX `idx_email` ON `t_third_party_calendar_list` (`email`);
-- 授权日历设备关联表
CREATE
TABLE
`t_third_party_calendar_device`
(
`third_party_calendar_device_id`
BIGINT
NOT
NULL
COMMENT
'主键'
,
`third_party_calendar_auth_id`
BIGINT
NOT
NULL
COMMENT
't_third_party_calendar_auth 第三方日历授权id'
,
`device_id`
BIGINT
NOT
NULL
COMMENT
'设备id'
,
`create_time`
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
`update_time`
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
CREATE
TABLE
`t_third_party_calendar_device`
(
`third_party_calendar_device_id`
BIGINT
NOT
NULL
COMMENT
'主键'
,
`third_party_calendar_auth_id`
BIGINT
NOT
NULL
COMMENT
't_third_party_calendar_auth 第三方日历授权id'
,
`device_id`
BIGINT
NOT
NULL
COMMENT
'设备id'
,
`create_time`
datetime
default
CURRENT_TIMESTAMP
not
null
comment
'创建时间,插入时自动更新'
,
`update_time`
datetime
default
CURRENT_TIMESTAMP
not
null
on
update
CURRENT_TIMESTAMP
comment
'更新时间,插入和更新时自动更新'
,
PRIMARY
KEY
(
`third_party_calendar_device_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'授权日历设备关联表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'授权日历设备关联表'
;
CREATE
INDEX
idx_third_party_calendar_auth_id
ON
t_third_party_calendar_device
(
third_party_calendar_auth_id
);
CREATE
INDEX
idx_device_id
ON
t_third_party_calendar_device
(
device_id
);
CREATE
INDEX
idx_third_party_calendar_auth_id
ON
t_third_party_calendar_device
(
third_party_calendar_auth_id
);
CREATE
INDEX
idx_device_id
ON
t_third_party_calendar_device
(
device_id
);
alter
table
t_third_party_calendar_list
add
device_id
BIGINT
null
comment
'设备ID'
;
...
...
@@ -188,6 +195,10 @@ alter table t_third_party_calendar_list
add
source_type
tinyint
null
comment
'第三方日历类型,0:表示Google,1:表示Outlook'
;
create
index
t_events_source_type_index
on
t_events
(
source_type
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment