1 files added
1 files modified
| | |
| | | database: "monitor", |
| | | user : "root", |
| | | password : "xOlx8z9L7Pt6y9YI" |
| | | }, |
| | | |
| | | mysql_2: { |
| | | host : "47.96.26.152", |
| | | database: "monitor_db", |
| | | user : "root", |
| | | password : "xOlx8z9L7Pt6y9YI" |
| | | } |
| | | }; |
| | | |
New file |
| | |
| | | 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(); |