This commit is contained in:
parent
b0dbbc3d3d
commit
b0cb2bcc3a
|
|
@ -1,3 +1,4 @@
|
|||
cd src
|
||||
pyinstaller --onefile --add-data "install/Common.py:install" --add-data "datas/init.sql:datas" .\install\InstallMariaDB.py
|
||||
pyinstaller --onefile --add-data "install/Common.py:install" --add-data "datas/nssm.exe:datas" --add-data "datas/electromagnetic.jar:datas" .\install\InstallComacDB.py
|
||||
pyinstaller --onefile --add-data "install/Common.py:install" --add-data "datas/init.sql:datas" .\install\UpdateSql.py
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -8,6 +8,7 @@ mariadb_port = 3417
|
|||
mariadb_passowrd = '1qaz@WSX'
|
||||
mariadb_user='root'
|
||||
mariadb_init_schema = 'em_data_prod'
|
||||
comac_db_port=12396
|
||||
|
||||
|
||||
class MyCustomError(Exception):
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class InstallComacDb:
|
|||
f"--winPrefix={self.run_dir} "
|
||||
f"--spring.datasource.username={mariadb_user} "
|
||||
f"--spring.datasource.password={mariadb_passowrd} "
|
||||
f"--server.port={comac_db_port} "
|
||||
f"--spring.datasource.url=jdbc:mariadb://127.0.0.1:{mariadb_port}/{mariadb_init_schema}?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&sslModel=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true"
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
import shutil
|
||||
import time
|
||||
|
||||
from Common import *
|
||||
from loguru import logger
|
||||
class UpdateSql():
|
||||
def __init__(self, install_path):
|
||||
self.service_name = 'ComacMariaDB'
|
||||
self.root_path = install_path
|
||||
self.mariadb_data_path = os.path.join(install_path, 'mariadb', 'data')
|
||||
self.mariadb_port = mariadb_port
|
||||
self.passowrd = mariadb_passowrd
|
||||
self.init_schema = mariadb_init_schema
|
||||
self.init_sql = os.path.join(install_path, 'mariadb', 'data', 'init.sql')
|
||||
|
||||
def init_db(self):
|
||||
new_path = get_resource_path(os.path.join('datas', 'init.sql'))
|
||||
shutil.copy(str(new_path), self.mariadb_data_path)
|
||||
command2 = fr'{self.root_path}\mariadb\bin\mysql --no-defaults -u root -p{self.passowrd} -P {self.mariadb_port} {self.init_schema} < {self.init_sql}'
|
||||
with os.popen(command2) as stream:
|
||||
res2 = stream.read()
|
||||
logger.info(res2)
|
||||
os.remove(self.init_sql)
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
current_dir = os.getcwd()
|
||||
logger.info("开始更新")
|
||||
UpdateSql(current_dir).init_db()
|
||||
logger.info("完成更新,3秒钟后退出")
|
||||
time.sleep(3)
|
||||
|
||||
Loading…
Reference in New Issue