From 94d8e0e336f3d9c9250a361aee6f63b8cb91af8f Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Wed, 31 Jan 2018 17:12:07 +0800
Subject: [PATCH] test

---
 server2.js |   24 ++++++++++++++++++++++++
 config.js  |    7 +++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/config.js b/config.js
index 9e71fd2..1a390bc 100644
--- a/config.js
+++ b/config.js
@@ -6,6 +6,13 @@
         database: "monitor",
         user : "root",
         password : "xOlx8z9L7Pt6y9YI"
+    },
+
+    mysql_2: {
+        host : "47.96.26.152",
+        database: "monitor_db",
+        user : "root",
+        password : "xOlx8z9L7Pt6y9YI"
     }
 };
 
diff --git a/server2.js b/server2.js
new file mode 100644
index 0000000..75b1d10
--- /dev/null
+++ b/server2.js
@@ -0,0 +1,24 @@
+var mysql = require('mysql');
+var moment = require('moment');
+var config = require('./config');
+
+var mysqlClient = mysql.createConnection(config.mysql_2);
+
+mysqlClient.connect(function(error) {
+    if (error) return;
+    //console.log("connected to MySQL");
+});
+
+var partition_name = "p" + moment().add(2, 'd').format("YYYYMMDD");
+var partition_date = moment().add(3, 'd').format("YYYYMMDD");
+
+var sql = "ALTER TABLE history ADD PARTITION (PARTITION " + partition_name + " VALUES LESS THAN ('" + partition_date + "'))";
+//console.log(sql);
+
+mysqlClient.query(sql, function (error, results, fields) {
+    if (error) throw error;
+    //console.log(results);
+    //console.log(fields);
+});
+
+mysqlClient.end();
\ No newline at end of file

--
Gitblit v1.8.0