Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
wanli
evm-store
Commits
e9cd3409
Commit
e9cd3409
authored
Jul 20, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat(项目工具):
添加数据库迁移工具
parent
5e1f3e7a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
4 deletions
+79
-4
frontend/src/views/system/monitor.vue
frontend/src/views/system/monitor.vue
+3
-1
tools/build_out/application/config.py
tools/build_out/application/config.py
+1
-1
tools/build_out/manager.py
tools/build_out/manager.py
+2
-2
tools/database_migration.py
tools/database_migration.py
+73
-0
No files found.
frontend/src/views/system/monitor.vue
View file @
e9cd3409
...
...
@@ -529,8 +529,10 @@ export default {
var
keys
=
this
.
form
[
item
];
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
var
k
=
keys
[
i
];
// 只有当png_uncompressed_size不为0才更新
if
(
item
==
"
image
"
)
{
for
(
var
j
=
0
;
j
<
msg
[
item
].
length
;
j
++
)
{
if
(
msg
[
item
][
j
][
k
])
msg
[
item
][
j
][
k
]
=
Math
.
ceil
(
msg
[
item
][
j
][
k
]
/
1024
);
}
}
else
{
...
...
tools/build_out/application/config.py
View file @
e9cd3409
'''
Author: your name
Date: 2021-06-30 17:43:46
LastEditTime: 2021-07-
14 18:40:19
LastEditTime: 2021-07-
20 19:13:33
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\a
pplication
\
config.py
...
...
tools/build_out/manager.py
View file @
e9cd3409
'''
Author: your name
Date: 2021-06-15 17:40:09
LastEditTime: 2021-07-
19 23:46:49
LastEditTime: 2021-07-
20 19:15:04
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\r
esources
\
manager.py
...
...
@@ -41,7 +41,7 @@ def run():
# app.logger.setLevel(app.config.get('LOG_LEVEL', logging.INFO))
http_server
=
HTTPServer
(
WSGIContainer
(
app
))
http_server
.
listen
(
3000
,
address
=
'127.0.0.1'
,
xheaders
=
True
)
http_server
.
listen
(
3000
,
address
=
'127.0.0.1'
)
IOLoop
.
instance
()
.
start
()
@
manager
.
command
...
...
tools/database_migration.py
0 → 100644
View file @
e9cd3409
# -*- coding: utf-8 -*-
'''
Author: your name
Date: 2021-07-20 19:04:27
LastEditTime: 2021-07-20 20:45:12
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\
database_migration.py
'''
import
sqlite3
import
uuid
source_conn
=
sqlite3
.
connect
(
'/mnt/d/projects/scriptiot/evm-store/tools/app-store.db'
)
source_cur
=
source_conn
.
cursor
()
target_conn
=
sqlite3
.
connect
(
'/mnt/d/projects/scriptiot/evm-store/tools/evue-store.db'
)
target_cur
=
source_conn
.
cursor
()
# 更新user表
opts
=
[
[
2
,
39
],
[
3
,
40
],
[
4
,
41
]
]
sqls
=
[
"update evm_store_annex set create_by = {a} where create_by = {b};"
,
"update evm_store_annex set update_by = {a} where update_by = {b};"
,
"update evm_store_app_logs set create_by = {a} where create_by = {b};"
,
"update evm_store_build_logs set create_by = {a} where create_by = {b};"
,
"update evm_store_build_logs set update_by = {a} where update_by = {b};"
,
"update evm_store_device set create_by = {a} where create_by = {b};"
,
"update evm_store_device set update_by = {a} where update_by = {b};"
,
"update evm_store_login_logs set create_by = {a} where create_by = {b};"
,
]
for
s
in
sqls
:
for
o
in
opts
:
string
=
s
.
format
(
a
=
o
[
0
],
b
=
o
[
1
])
source_cur
.
execute
(
string
)
source_conn
.
commit
()
# 先插入user表
source_cur
.
execute
(
'SELECT account, username, password, email, phone, create_at, create_by, update_at, update_by FROM evm_store_user'
)
sql
=
"insert evm_user (id, uuid, account, username, password, email, phone, create_at, create_by, update_at, update_byis_delete, is_delete) values ({a}, {b}, {c}, {d}, {e}, {f}, {g}, {h}, {i}, {j}, {k}, 0);"
res
=
source_cur
.
fetchall
()
i
=
0
for
line
in
res
:
i
+=
1
sql
.
format
(
a
=
i
,
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
0
],
d
=
line
[
1
],
e
=
line
[
2
],
f
=
line
[
3
],
g
=
line
[
4
],
h
=
line
[
5
],
i
=
line
[
6
],
j
=
line
[
7
],
k
=
line
[
8
])
target_cur
.
execute
(
string
)
target_conn
.
commit
()
# login logs
source_cur
.
execute
(
'SELECT id, username, ip, address, create_at, create_by, remarks FROM evm_store_login_logs'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_login (id, uuid, user, login_at, user_agent, ip, geo_location, operator, create_at, create_by, update_at, update_by, is_delete) values ({a}, {b}, {c}, {d}, {e}, {f}, {g}, {h}, {i}, {j}, {k}, {l}, 0);"
for
line
in
res
:
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
5
],
d
=
line
[
6
],
e
=
""
,
f
=
line
[
2
],
g
=
line
[
3
],
h
=
""
,
i
=
line
[
4
],
j
=
line
[
5
],
k
=
line
[
4
],
l
=
line
[
5
])
target_cur
.
execute
(
string
)
target_conn
.
commit
()
# app
source_cur
.
execute
(
'SELECT id, app_name, app_version, app_url, category, create_by, remarks FROM evm_store_apps'
)
res
=
source_cur
.
fetchall
()
target_conn
.
commit
()
target_conn
.
close
()
source_conn
.
commit
()
source_conn
.
close
()
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