Merge branch 'develop'
commit
24ec250d02
|
@ -175,12 +175,13 @@ sed -i 's/127.0.0.1/192.168.0.2/g' myems-normalization/.env
|
||||||
|
|
||||||
**3.3** 测试数据库是否可以正确连接
|
**3.3** 测试数据库是否可以正确连接
|
||||||
```
|
```
|
||||||
python3 myems/database/test_mysql.py
|
cd myems
|
||||||
|
python3 myems-api/test_mysql.py
|
||||||
```
|
```
|
||||||
注:如果测试通过,继续下一步操作,否则请修改.env配置,确保数据库可以通过Python3正常连接访问。
|
注:如果测试通过,继续下一步操作,否则请修改.env配置。
|
||||||
|
|
||||||
|
|
||||||
- 4.web打包 (myems/web为React项目,需要打包为产品文件)
|
- 4.web打包 (Web UI 为React项目,需要打包为产品文件)
|
||||||
|
|
||||||
```
|
```
|
||||||
cd myems/web
|
cd myems/web
|
||||||
|
@ -197,7 +198,6 @@ docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- 6.测试
|
- 6.测试
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,18 @@
|
||||||
|
|
||||||
### Introduction
|
### Introduction
|
||||||
|
|
||||||
Providing database schema and scripts for MyEMS.
|
Database schema and scripts for MyEMS.
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
[MySQL 8.0 or later](https://www.mysql.com/)
|
[MySQL 8.0 (64bit) or later](https://www.mysql.com/)
|
||||||
|
|
||||||
or [MariaDB 10.5 or later](https://mariadb.org/)
|
or
|
||||||
|
|
||||||
or [SingleStore 7.0 or later](https://www.singlestore.com/) (highly recommended)
|
[MariaDB 10.5 (64bit) or later](https://mariadb.org/)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
[SingleStore 7.0 or later](https://www.singlestore.com/)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
@ -56,6 +60,8 @@ set global net_buffer_length=1000000;
|
||||||
set global max_allowed_packet=1000000000;
|
set global max_allowed_packet=1000000000;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Don't Install Database in Docker
|
||||||
|
|
||||||
### Database Definition
|
### Database Definition
|
||||||
|
|
||||||
#### myems_billing_baseline_db
|
#### myems_billing_baseline_db
|
||||||
|
|
|
@ -14,6 +14,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_email_messages` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_email_messages` (
|
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_email_messages` (
|
||||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
|
`rule_id` BIGINT NOT NULL,
|
||||||
`recipient_name` VARCHAR(128) NOT NULL,
|
`recipient_name` VARCHAR(128) NOT NULL,
|
||||||
`recipient_email` VARCHAR(128) NOT NULL,
|
`recipient_email` VARCHAR(128) NOT NULL,
|
||||||
`subject` VARCHAR(128) NOT NULL,
|
`subject` VARCHAR(128) NOT NULL,
|
||||||
|
@ -82,6 +83,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_text_messages_outbox` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_text_messages_outbox` (
|
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_text_messages_outbox` (
|
||||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
|
`rule_id` BIGINT NOT NULL,
|
||||||
`recipient_name` VARCHAR(32) NOT NULL,
|
`recipient_name` VARCHAR(32) NOT NULL,
|
||||||
`recipient_mobile` VARCHAR(32) NOT NULL,
|
`recipient_mobile` VARCHAR(32) NOT NULL,
|
||||||
`message` LONGTEXT NOT NULL,
|
`message` LONGTEXT NOT NULL,
|
||||||
|
@ -114,6 +116,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_web_messages` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_web_messages` (
|
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_web_messages` (
|
||||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
|
`rule_id` BIGINT NOT NULL,
|
||||||
`user_id` BIGINT NOT NULL,
|
`user_id` BIGINT NOT NULL,
|
||||||
`subject` VARCHAR(128) NOT NULL,
|
`subject` VARCHAR(128) NOT NULL,
|
||||||
`category` VARCHAR(128) NOT NULL COMMENT 'SYSTEM, SPACE, METER, TENANT, STORE, SHOPFLOOR, EQUIPMENT, COMBINEDEQUIPMENT',
|
`category` VARCHAR(128) NOT NULL COMMENT 'SYSTEM, SPACE, METER, TENANT, STORE, SHOPFLOOR, EQUIPMENT, COMBINEDEQUIPMENT',
|
||||||
|
@ -147,6 +150,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_wechat_messages_outbox` ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_wechat_messages_outbox` (
|
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_wechat_messages_outbox` (
|
||||||
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
`id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
|
`rule_id` BIGINT NOT NULL,
|
||||||
`recipient_name` VARCHAR(32) NOT NULL,
|
`recipient_name` VARCHAR(32) NOT NULL,
|
||||||
`recipient_openid` VARCHAR(32) NOT NULL,
|
`recipient_openid` VARCHAR(32) NOT NULL,
|
||||||
`message_template_id` VARCHAR(64) NOT NULL,
|
`message_template_id` VARCHAR(64) NOT NULL,
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
import mysql.connector
|
|
||||||
import config
|
|
||||||
|
|
||||||
|
|
||||||
def test_connect():
|
|
||||||
cursor = None
|
|
||||||
cnx = None
|
|
||||||
try:
|
|
||||||
cnx = mysql.connector.connect(**config.myems_user_db)
|
|
||||||
cursor = cnx.cursor()
|
|
||||||
|
|
||||||
query = (" SELECT id, name, display_name, email "
|
|
||||||
" FROM tbl_users "
|
|
||||||
" ORDER BY id ")
|
|
||||||
cursor.execute(query)
|
|
||||||
rows = cursor.fetchall()
|
|
||||||
print("The config of database is right:", rows)
|
|
||||||
except Exception as e:
|
|
||||||
print("The config of database is wrong:", str(e))
|
|
||||||
finally:
|
|
||||||
if cursor:
|
|
||||||
cursor.close()
|
|
||||||
if cnx:
|
|
||||||
cnx.disconnect()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_connect()
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
-- PLEASE CHECK YOUR DATABASE TABLES BELOW, IF rule_id IS MISSING, THEN RUN BELOW STATEMENTS
|
||||||
|
-- IF rule_id EXISTS, THEN IGNORE THESE STATEMENTS
|
||||||
|
ALTER TABLE myems_fdd_db.tbl_email_messages ADD rule_id BIGINT NOT NULL AFTER id;
|
||||||
|
ALTER TABLE myems_fdd_db.tbl_text_messages_outbox ADD rule_id BIGINT NOT NULL AFTER id;
|
||||||
|
ALTER TABLE myems_fdd_db.tbl_web_messages ADD rule_id BIGINT NOT NULL AFTER id;
|
||||||
|
ALTER TABLE myems_fdd_db.tbl_wechat_messages_outbox ADD rule_id BIGINT NOT NULL AFTER id;
|
||||||
|
|
||||||
|
|
||||||
|
-- UPDATE VERSION NUMBER
|
||||||
|
UPDATE myems_system_db.tbl_versions SET version='1.3.3', release_date='2021-10-29' WHERE id=1;
|
|
@ -0,0 +1,26 @@
|
||||||
|
import mysql.connector
|
||||||
|
import config
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
cursor = None
|
||||||
|
cnx = None
|
||||||
|
try:
|
||||||
|
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||||
|
cursor = cnx.cursor()
|
||||||
|
|
||||||
|
query = (" SELECT version "
|
||||||
|
" FROM tbl_versions "
|
||||||
|
" WHERE id = 1 ")
|
||||||
|
cursor.execute(query)
|
||||||
|
row = cursor.fetchone()
|
||||||
|
if row is not None and len(row) > 0:
|
||||||
|
print("The database version is : ", str(row[0]))
|
||||||
|
except Exception as e:
|
||||||
|
print("There is something wrong with database :", str(e))
|
||||||
|
finally:
|
||||||
|
if cursor:
|
||||||
|
cursor.close()
|
||||||
|
if cnx:
|
||||||
|
cnx.disconnect()
|
Loading…
Reference in New Issue