added sqldump and sqldrop commands

This commit is contained in:
Andris Reinman 2016-04-20 20:17:53 +03:00
parent 77b3ded476
commit 0f5ac18479
10 changed files with 102 additions and 215 deletions

View file

@ -28,7 +28,7 @@ Subscribe to Mailtrain Newsletter [here](http://mailtrain.org/subscription/EysIv
1. Download Mailtrain files using git: `git clone git://github.com/andris9/mailtrain.git` and open Mailtrain folder `cd mailtrain` 1. Download Mailtrain files using git: `git clone git://github.com/andris9/mailtrain.git` and open Mailtrain folder `cd mailtrain`
2. Run `npm install` in the Mailtrain folder to install required dependencies 2. Run `npm install` in the Mailtrain folder to install required dependencies
3. Copy [config/default.toml](config/default.toml) as `config/production.toml` and update MySQL and any other settings in it 3. Copy [config/default.toml](config/default.toml) as `config/production.toml` and update MySQL and any other settings in it
4. Import SQL tables by running `npm run sql` (invokes `mysql` command in the background, so you should have it installed). If MySQL configuration in config file is not correct then this command fails 4. Import SQL tables by running `npm run sql` (invokes `mysql` command in the background, so you should have it installed. If you can't use this command, then you can import the [database file](setup/sql/mailtrain.sql) yourself). If MySQL configuration in config file is not correct then this command fails.
5. Run the server `NODE_ENV=production npm start` 5. Run the server `NODE_ENV=production npm start`
6. Open [http://localhost:3000/](http://localhost:3000/) 6. Open [http://localhost:3000/](http://localhost:3000/)
7. Authenticate as `admin`:`test` 7. Authenticate as `admin`:`test`

View file

@ -7,7 +7,9 @@
"scripts": { "scripts": {
"test": "grunt", "test": "grunt",
"start": "node index.js", "start": "node index.js",
"sql": "node setup/sql.js" "sql": "node setup/sql/sql.js",
"sqldump": "node setup/sql/dump.js | sed -e '/^--.*$/d' > setup/sql/mailtrain.sql",
"sqldrop": "node setup/sql/drop.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -53,7 +55,7 @@
"openpgp": "^2.2.1", "openpgp": "^2.2.1",
"passport": "^0.3.2", "passport": "^0.3.2",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"request": "^2.71.0", "request": "^2.72.0",
"serve-favicon": "^2.3.0", "serve-favicon": "^2.3.0",
"shortid": "^2.2.6", "shortid": "^2.2.6",
"slugify": "^0.1.1", "slugify": "^0.1.1",

View file

@ -1,8 +1,3 @@
-- MySQL dump 10.13 Distrib 5.7.11, for osx10.11 (x86_64)
--
-- Host: localhost Database: mailtrain
-- ------------------------------------------------------
-- Server version 5.7.11
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -15,9 +10,6 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `campaign`
--
DROP TABLE IF EXISTS `campaign`; DROP TABLE IF EXISTS `campaign`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -36,21 +28,15 @@ CREATE TABLE `campaign` (
UNIQUE KEY `list` (`list`,`segment`,`subscription`), UNIQUE KEY `list` (`list`,`segment`,`subscription`),
KEY `created` (`created`), KEY `created` (`created`),
KEY `response_id` (`response_id`) KEY `response_id` (`response_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `campaign`
--
LOCK TABLES `campaign` WRITE; LOCK TABLES `campaign` WRITE;
/*!40000 ALTER TABLE `campaign` DISABLE KEYS */; /*!40000 ALTER TABLE `campaign` DISABLE KEYS */;
/*!40000 ALTER TABLE `campaign` ENABLE KEYS */; /*!40000 ALTER TABLE `campaign` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `campaign_tracker`
--
DROP TABLE IF EXISTS `campaign_tracker`; DROP TABLE IF EXISTS `campaign_tracker`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -63,21 +49,15 @@ CREATE TABLE `campaign_tracker` (
`country` varchar(2) CHARACTER SET ascii DEFAULT NULL, `country` varchar(2) CHARACTER SET ascii DEFAULT NULL,
`count` int(11) unsigned NOT NULL DEFAULT '1', `count` int(11) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`list`,`subscriber`,`link`) PRIMARY KEY (`list`,`subscriber`,`link`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `campaign_tracker`
--
LOCK TABLES `campaign_tracker` WRITE; LOCK TABLES `campaign_tracker` WRITE;
/*!40000 ALTER TABLE `campaign_tracker` DISABLE KEYS */; /*!40000 ALTER TABLE `campaign_tracker` DISABLE KEYS */;
/*!40000 ALTER TABLE `campaign_tracker` ENABLE KEYS */; /*!40000 ALTER TABLE `campaign_tracker` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `campaigns`
--
DROP TABLE IF EXISTS `campaigns`; DROP TABLE IF EXISTS `campaigns`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -111,18 +91,12 @@ CREATE TABLE `campaigns` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `campaigns`
--
LOCK TABLES `campaigns` WRITE; LOCK TABLES `campaigns` WRITE;
/*!40000 ALTER TABLE `campaigns` DISABLE KEYS */; /*!40000 ALTER TABLE `campaigns` DISABLE KEYS */;
/*!40000 ALTER TABLE `campaigns` ENABLE KEYS */; /*!40000 ALTER TABLE `campaigns` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `confirmations`
--
DROP TABLE IF EXISTS `confirmations`; DROP TABLE IF EXISTS `confirmations`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -141,18 +115,12 @@ CREATE TABLE `confirmations` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `confirmations`
--
LOCK TABLES `confirmations` WRITE; LOCK TABLES `confirmations` WRITE;
/*!40000 ALTER TABLE `confirmations` DISABLE KEYS */; /*!40000 ALTER TABLE `confirmations` DISABLE KEYS */;
/*!40000 ALTER TABLE `confirmations` ENABLE KEYS */; /*!40000 ALTER TABLE `confirmations` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `custom_fields`
--
DROP TABLE IF EXISTS `custom_fields`; DROP TABLE IF EXISTS `custom_fields`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -172,21 +140,15 @@ CREATE TABLE `custom_fields` (
UNIQUE KEY `list` (`list`,`column`), UNIQUE KEY `list` (`list`,`column`),
KEY `list_2` (`list`), KEY `list_2` (`list`),
CONSTRAINT `custom_fields_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE CONSTRAINT `custom_fields_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `custom_fields`
--
LOCK TABLES `custom_fields` WRITE; LOCK TABLES `custom_fields` WRITE;
/*!40000 ALTER TABLE `custom_fields` DISABLE KEYS */; /*!40000 ALTER TABLE `custom_fields` DISABLE KEYS */;
/*!40000 ALTER TABLE `custom_fields` ENABLE KEYS */; /*!40000 ALTER TABLE `custom_fields` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `importer`
--
DROP TABLE IF EXISTS `importer`; DROP TABLE IF EXISTS `importer`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -207,21 +169,15 @@ CREATE TABLE `importer` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `list` (`list`), KEY `list` (`list`),
CONSTRAINT `importer_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE CONSTRAINT `importer_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `importer`
--
LOCK TABLES `importer` WRITE; LOCK TABLES `importer` WRITE;
/*!40000 ALTER TABLE `importer` DISABLE KEYS */; /*!40000 ALTER TABLE `importer` DISABLE KEYS */;
/*!40000 ALTER TABLE `importer` ENABLE KEYS */; /*!40000 ALTER TABLE `importer` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `links`
--
DROP TABLE IF EXISTS `links`; DROP TABLE IF EXISTS `links`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -237,21 +193,15 @@ CREATE TABLE `links` (
UNIQUE KEY `campaign_2` (`campaign`,`url`), UNIQUE KEY `campaign_2` (`campaign`,`url`),
KEY `campaign` (`campaign`), KEY `campaign` (`campaign`),
CONSTRAINT `links_ibfk_1` FOREIGN KEY (`campaign`) REFERENCES `campaigns` (`id`) ON DELETE CASCADE CONSTRAINT `links_ibfk_1` FOREIGN KEY (`campaign`) REFERENCES `campaigns` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `links`
--
LOCK TABLES `links` WRITE; LOCK TABLES `links` WRITE;
/*!40000 ALTER TABLE `links` DISABLE KEYS */; /*!40000 ALTER TABLE `links` DISABLE KEYS */;
/*!40000 ALTER TABLE `links` ENABLE KEYS */; /*!40000 ALTER TABLE `links` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `lists`
--
DROP TABLE IF EXISTS `lists`; DROP TABLE IF EXISTS `lists`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -269,18 +219,12 @@ CREATE TABLE `lists` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lists`
--
LOCK TABLES `lists` WRITE; LOCK TABLES `lists` WRITE;
/*!40000 ALTER TABLE `lists` DISABLE KEYS */; /*!40000 ALTER TABLE `lists` DISABLE KEYS */;
/*!40000 ALTER TABLE `lists` ENABLE KEYS */; /*!40000 ALTER TABLE `lists` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `segment_rules`
--
DROP TABLE IF EXISTS `segment_rules`; DROP TABLE IF EXISTS `segment_rules`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -296,18 +240,12 @@ CREATE TABLE `segment_rules` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `segment_rules`
--
LOCK TABLES `segment_rules` WRITE; LOCK TABLES `segment_rules` WRITE;
/*!40000 ALTER TABLE `segment_rules` DISABLE KEYS */; /*!40000 ALTER TABLE `segment_rules` DISABLE KEYS */;
/*!40000 ALTER TABLE `segment_rules` ENABLE KEYS */; /*!40000 ALTER TABLE `segment_rules` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `segments`
--
DROP TABLE IF EXISTS `segments`; DROP TABLE IF EXISTS `segments`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -325,18 +263,12 @@ CREATE TABLE `segments` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `segments`
--
LOCK TABLES `segments` WRITE; LOCK TABLES `segments` WRITE;
/*!40000 ALTER TABLE `segments` DISABLE KEYS */; /*!40000 ALTER TABLE `segments` DISABLE KEYS */;
/*!40000 ALTER TABLE `segments` ENABLE KEYS */; /*!40000 ALTER TABLE `segments` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`; DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -350,9 +282,6 @@ CREATE TABLE `settings` (
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `settings`
--
LOCK TABLES `settings` WRITE; LOCK TABLES `settings` WRITE;
/*!40000 ALTER TABLE `settings` DISABLE KEYS */; /*!40000 ALTER TABLE `settings` DISABLE KEYS */;
@ -360,9 +289,6 @@ INSERT INTO `settings` VALUES (1,'smtp_hostname','localhost'),(2,'smtp_port','46
/*!40000 ALTER TABLE `settings` ENABLE KEYS */; /*!40000 ALTER TABLE `settings` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `subscription`
--
DROP TABLE IF EXISTS `subscription`; DROP TABLE IF EXISTS `subscription`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -390,18 +316,12 @@ CREATE TABLE `subscription` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `subscription`
--
LOCK TABLES `subscription` WRITE; LOCK TABLES `subscription` WRITE;
/*!40000 ALTER TABLE `subscription` DISABLE KEYS */; /*!40000 ALTER TABLE `subscription` DISABLE KEYS */;
/*!40000 ALTER TABLE `subscription` ENABLE KEYS */; /*!40000 ALTER TABLE `subscription` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `templates`
--
DROP TABLE IF EXISTS `templates`; DROP TABLE IF EXISTS `templates`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -418,18 +338,12 @@ CREATE TABLE `templates` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `templates`
--
LOCK TABLES `templates` WRITE; LOCK TABLES `templates` WRITE;
/*!40000 ALTER TABLE `templates` DISABLE KEYS */; /*!40000 ALTER TABLE `templates` DISABLE KEYS */;
/*!40000 ALTER TABLE `templates` ENABLE KEYS */; /*!40000 ALTER TABLE `templates` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`; DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -450,9 +364,6 @@ CREATE TABLE `users` (
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE; LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */; /*!40000 ALTER TABLE `users` DISABLE KEYS */;
@ -468,5 +379,3 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-04-04 14:25:59

39
setup/sql/drop.js Normal file
View file

@ -0,0 +1,39 @@
'use strict';
let config = require('config');
let spawn = require('child_process').spawn;
let log = require('npmlog');
let path = require('path');
log.level = 'verbose';
function createDump(callback) {
let cmd = spawn(path.join(__dirname, 'drop.sh'), [], {
env: {
MYSQL_HOST: config.mysql.host || 'localhost',
MYSQL_DB: config.mysql.database,
MYSQL_PORT: config.mysql.port || 3306,
MYSQL_USER: config.mysql.user,
MYSQL_PASSWORD: config.mysql.password
}
});
cmd.stdout.pipe(process.stdout);
cmd.stderr.pipe(process.stderr);
cmd.on('close', code => {
if (code) {
return callback(new Error('drop command exited with code ' + code));
}
return callback(null, true);
});
}
createDump(err => {
if (err) {
log.error('sqldrop', err);
process.exit(1);
}
log.info('sqldrop', 'Command completed, all tables dropped from "%s"', config.mysql.database);
process.exit(0);
});

3
setup/sql/drop.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
mysqldump -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" "-p${MYSQL_PASSWORD}" --add-drop-table --no-data "$MYSQL_DB" | grep -e '^DROP \| FOREIGN_KEY_CHECKS' | mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" "-p${MYSQL_PASSWORD}" "$MYSQL_DB"

30
setup/sql/dump.js Normal file
View file

@ -0,0 +1,30 @@
'use strict';
let config = require('config');
let spawn = require('child_process').spawn;
let log = require('npmlog');
log.level = 'verbose';
function createDump(callback) {
let cmd = spawn('mysqldump', ['-h', config.mysql.host || 'localhost', '-P', config.mysql.port || 3306, '-u', config.mysql.user, '-p' + config.mysql.password, '--opt', config.mysql.database]);
cmd.stdout.pipe(process.stdout);
cmd.stderr.pipe(process.stderr);
cmd.on('close', code => {
if (code) {
return callback(new Error('mysqldump command exited with code ' + code));
}
return callback(null, true);
});
}
createDump(err => {
if (err) {
log.error('sqldump', err);
process.exit(1);
}
log.info('sqldump', 'MySQL Dump Completed');
process.exit(0);
});

View file

@ -1,8 +1,3 @@
-- MySQL dump 10.16 Distrib 10.1.12-MariaDB, for osx10.11 (x86_64)
--
-- Host: localhost Database: frontmail
-- ------------------------------------------------------
-- Server version 10.1.12-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@ -15,9 +10,6 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `campaign`
--
DROP TABLE IF EXISTS `campaign`; DROP TABLE IF EXISTS `campaign`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -36,21 +28,15 @@ CREATE TABLE `campaign` (
UNIQUE KEY `list` (`list`,`segment`,`subscription`), UNIQUE KEY `list` (`list`,`segment`,`subscription`),
KEY `created` (`created`), KEY `created` (`created`),
KEY `response_id` (`response_id`) KEY `response_id` (`response_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `campaign`
--
LOCK TABLES `campaign` WRITE; LOCK TABLES `campaign` WRITE;
/*!40000 ALTER TABLE `campaign` DISABLE KEYS */; /*!40000 ALTER TABLE `campaign` DISABLE KEYS */;
/*!40000 ALTER TABLE `campaign` ENABLE KEYS */; /*!40000 ALTER TABLE `campaign` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `campaign_tracker`
--
DROP TABLE IF EXISTS `campaign_tracker`; DROP TABLE IF EXISTS `campaign_tracker`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -63,21 +49,15 @@ CREATE TABLE `campaign_tracker` (
`country` varchar(2) CHARACTER SET ascii DEFAULT NULL, `country` varchar(2) CHARACTER SET ascii DEFAULT NULL,
`count` int(11) unsigned NOT NULL DEFAULT '1', `count` int(11) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`list`,`subscriber`,`link`) PRIMARY KEY (`list`,`subscriber`,`link`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `campaign_tracker`
--
LOCK TABLES `campaign_tracker` WRITE; LOCK TABLES `campaign_tracker` WRITE;
/*!40000 ALTER TABLE `campaign_tracker` DISABLE KEYS */; /*!40000 ALTER TABLE `campaign_tracker` DISABLE KEYS */;
/*!40000 ALTER TABLE `campaign_tracker` ENABLE KEYS */; /*!40000 ALTER TABLE `campaign_tracker` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `campaigns`
--
DROP TABLE IF EXISTS `campaigns`; DROP TABLE IF EXISTS `campaigns`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -111,18 +91,12 @@ CREATE TABLE `campaigns` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `campaigns`
--
LOCK TABLES `campaigns` WRITE; LOCK TABLES `campaigns` WRITE;
/*!40000 ALTER TABLE `campaigns` DISABLE KEYS */; /*!40000 ALTER TABLE `campaigns` DISABLE KEYS */;
/*!40000 ALTER TABLE `campaigns` ENABLE KEYS */; /*!40000 ALTER TABLE `campaigns` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `confirmations`
--
DROP TABLE IF EXISTS `confirmations`; DROP TABLE IF EXISTS `confirmations`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -141,18 +115,12 @@ CREATE TABLE `confirmations` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `confirmations`
--
LOCK TABLES `confirmations` WRITE; LOCK TABLES `confirmations` WRITE;
/*!40000 ALTER TABLE `confirmations` DISABLE KEYS */; /*!40000 ALTER TABLE `confirmations` DISABLE KEYS */;
/*!40000 ALTER TABLE `confirmations` ENABLE KEYS */; /*!40000 ALTER TABLE `confirmations` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `custom_fields`
--
DROP TABLE IF EXISTS `custom_fields`; DROP TABLE IF EXISTS `custom_fields`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -160,9 +128,9 @@ DROP TABLE IF EXISTS `custom_fields`;
CREATE TABLE `custom_fields` ( CREATE TABLE `custom_fields` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`list` int(11) unsigned NOT NULL, `list` int(11) unsigned NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 DEFAULT '', `name` varchar(255) DEFAULT '',
`key` varchar(100) CHARACTER SET ascii NOT NULL, `key` varchar(100) CHARACTER SET ascii NOT NULL,
`default_value` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL, `default_value` varchar(255) DEFAULT NULL,
`type` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '', `type` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '',
`group` int(11) unsigned DEFAULT NULL, `group` int(11) unsigned DEFAULT NULL,
`column` varchar(255) CHARACTER SET ascii DEFAULT NULL, `column` varchar(255) CHARACTER SET ascii DEFAULT NULL,
@ -172,21 +140,15 @@ CREATE TABLE `custom_fields` (
UNIQUE KEY `list` (`list`,`column`), UNIQUE KEY `list` (`list`,`column`),
KEY `list_2` (`list`), KEY `list_2` (`list`),
CONSTRAINT `custom_fields_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE CONSTRAINT `custom_fields_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `custom_fields`
--
LOCK TABLES `custom_fields` WRITE; LOCK TABLES `custom_fields` WRITE;
/*!40000 ALTER TABLE `custom_fields` DISABLE KEYS */; /*!40000 ALTER TABLE `custom_fields` DISABLE KEYS */;
/*!40000 ALTER TABLE `custom_fields` ENABLE KEYS */; /*!40000 ALTER TABLE `custom_fields` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `import_failed`
--
DROP TABLE IF EXISTS `import_failed`; DROP TABLE IF EXISTS `import_failed`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -203,18 +165,12 @@ CREATE TABLE `import_failed` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `import_failed`
--
LOCK TABLES `import_failed` WRITE; LOCK TABLES `import_failed` WRITE;
/*!40000 ALTER TABLE `import_failed` DISABLE KEYS */; /*!40000 ALTER TABLE `import_failed` DISABLE KEYS */;
/*!40000 ALTER TABLE `import_failed` ENABLE KEYS */; /*!40000 ALTER TABLE `import_failed` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `importer`
--
DROP TABLE IF EXISTS `importer`; DROP TABLE IF EXISTS `importer`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -230,26 +186,20 @@ CREATE TABLE `importer` (
`error` varchar(255) DEFAULT NULL, `error` varchar(255) DEFAULT NULL,
`processed` int(11) unsigned NOT NULL DEFAULT '0', `processed` int(11) unsigned NOT NULL DEFAULT '0',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`mapping` text CHARACTER SET utf8mb4 NOT NULL, `mapping` text NOT NULL,
`finished` timestamp NULL DEFAULT NULL, `finished` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `list` (`list`), KEY `list` (`list`),
CONSTRAINT `importer_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE CONSTRAINT `importer_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `importer`
--
LOCK TABLES `importer` WRITE; LOCK TABLES `importer` WRITE;
/*!40000 ALTER TABLE `importer` DISABLE KEYS */; /*!40000 ALTER TABLE `importer` DISABLE KEYS */;
/*!40000 ALTER TABLE `importer` ENABLE KEYS */; /*!40000 ALTER TABLE `importer` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `links`
--
DROP TABLE IF EXISTS `links`; DROP TABLE IF EXISTS `links`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -265,21 +215,15 @@ CREATE TABLE `links` (
UNIQUE KEY `campaign_2` (`campaign`,`url`), UNIQUE KEY `campaign_2` (`campaign`,`url`),
KEY `campaign` (`campaign`), KEY `campaign` (`campaign`),
CONSTRAINT `links_ibfk_1` FOREIGN KEY (`campaign`) REFERENCES `campaigns` (`id`) ON DELETE CASCADE CONSTRAINT `links_ibfk_1` FOREIGN KEY (`campaign`) REFERENCES `campaigns` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `links`
--
LOCK TABLES `links` WRITE; LOCK TABLES `links` WRITE;
/*!40000 ALTER TABLE `links` DISABLE KEYS */; /*!40000 ALTER TABLE `links` DISABLE KEYS */;
/*!40000 ALTER TABLE `links` ENABLE KEYS */; /*!40000 ALTER TABLE `links` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `lists`
--
DROP TABLE IF EXISTS `lists`; DROP TABLE IF EXISTS `lists`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -297,18 +241,12 @@ CREATE TABLE `lists` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lists`
--
LOCK TABLES `lists` WRITE; LOCK TABLES `lists` WRITE;
/*!40000 ALTER TABLE `lists` DISABLE KEYS */; /*!40000 ALTER TABLE `lists` DISABLE KEYS */;
/*!40000 ALTER TABLE `lists` ENABLE KEYS */; /*!40000 ALTER TABLE `lists` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `segment_rules`
--
DROP TABLE IF EXISTS `segment_rules`; DROP TABLE IF EXISTS `segment_rules`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -324,18 +262,12 @@ CREATE TABLE `segment_rules` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `segment_rules`
--
LOCK TABLES `segment_rules` WRITE; LOCK TABLES `segment_rules` WRITE;
/*!40000 ALTER TABLE `segment_rules` DISABLE KEYS */; /*!40000 ALTER TABLE `segment_rules` DISABLE KEYS */;
/*!40000 ALTER TABLE `segment_rules` ENABLE KEYS */; /*!40000 ALTER TABLE `segment_rules` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `segments`
--
DROP TABLE IF EXISTS `segments`; DROP TABLE IF EXISTS `segments`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -353,18 +285,12 @@ CREATE TABLE `segments` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `segments`
--
LOCK TABLES `segments` WRITE; LOCK TABLES `segments` WRITE;
/*!40000 ALTER TABLE `segments` DISABLE KEYS */; /*!40000 ALTER TABLE `segments` DISABLE KEYS */;
/*!40000 ALTER TABLE `segments` ENABLE KEYS */; /*!40000 ALTER TABLE `segments` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`; DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -378,9 +304,6 @@ CREATE TABLE `settings` (
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `settings`
--
LOCK TABLES `settings` WRITE; LOCK TABLES `settings` WRITE;
/*!40000 ALTER TABLE `settings` DISABLE KEYS */; /*!40000 ALTER TABLE `settings` DISABLE KEYS */;
@ -388,9 +311,6 @@ INSERT INTO `settings` VALUES (1,'smtp_hostname','localhost'),(2,'smtp_port','46
/*!40000 ALTER TABLE `settings` ENABLE KEYS */; /*!40000 ALTER TABLE `settings` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `subscription`
--
DROP TABLE IF EXISTS `subscription`; DROP TABLE IF EXISTS `subscription`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -418,18 +338,12 @@ CREATE TABLE `subscription` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `subscription`
--
LOCK TABLES `subscription` WRITE; LOCK TABLES `subscription` WRITE;
/*!40000 ALTER TABLE `subscription` DISABLE KEYS */; /*!40000 ALTER TABLE `subscription` DISABLE KEYS */;
/*!40000 ALTER TABLE `subscription` ENABLE KEYS */; /*!40000 ALTER TABLE `subscription` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `templates`
--
DROP TABLE IF EXISTS `templates`; DROP TABLE IF EXISTS `templates`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -446,18 +360,12 @@ CREATE TABLE `templates` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `templates`
--
LOCK TABLES `templates` WRITE; LOCK TABLES `templates` WRITE;
/*!40000 ALTER TABLE `templates` DISABLE KEYS */; /*!40000 ALTER TABLE `templates` DISABLE KEYS */;
/*!40000 ALTER TABLE `templates` ENABLE KEYS */; /*!40000 ALTER TABLE `templates` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`; DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -478,13 +386,10 @@ CREATE TABLE `users` (
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE; LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */; /*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'admin','$2a$10$mzKU71G62evnGB2PvQA4k..Wf9jASk.c7a8zRMHh6qQVjYJ2r/g/K','admin@example.com',NULL,NULL,'2016-04-19 08:51:04'); INSERT INTO `users` VALUES (1,'admin','$2a$10$mzKU71G62evnGB2PvQA4k..Wf9jASk.c7a8zRMHh6qQVjYJ2r/g/K','admin@example.com',NULL,NULL,'2016-04-20 17:15:36');
/*!40000 ALTER TABLE `users` ENABLE KEYS */; /*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -497,4 +402,3 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-04-19 11:53:09

View file

@ -1,9 +1,9 @@
'use strict'; 'use strict';
let config = require('config'); let config = require('config');
let db = require('../lib/db'); let db = require('../../lib/db');
let spawn = require('child_process').spawn; let spawn = require('child_process').spawn;
let settings = require('../lib/models/settings'); let settings = require('../../lib/models/settings');
let log = require('npmlog'); let log = require('npmlog');
let fs = require('fs'); let fs = require('fs');
let pathlib = require('path'); let pathlib = require('path');
@ -62,19 +62,19 @@ function getSchemaVersion(callback) {
function listUpdates(current, callback) { function listUpdates(current, callback) {
current = current || 0; current = current || 0;
fs.readdir(__dirname + '/sql', (err, list) => { fs.readdir(__dirname, (err, list) => {
if (err) { if (err) {
return callback(err); return callback(err);
} }
let updates = []; let updates = [];
[].concat(list || []).forEach(row => { [].concat(list || []).forEach(row => {
if (/^update-\d+\.sql$/i.test(row)) { if (/^upgrade-\d+\.sql$/i.test(row)) {
let seq = row.match(/\d+/)[0]; let seq = row.match(/\d+/)[0];
if (seq > current) { if (seq > current) {
updates.push({ updates.push({
seq: Number(seq), seq: Number(seq),
path: pathlib.join(__dirname, 'sql', row) path: pathlib.join(__dirname, row)
}); });
} }
} }
@ -95,7 +95,7 @@ function getSql(path, data, callback) {
} }
function runInitial(callback) { function runInitial(callback) {
let path = pathlib.join(__dirname, 'sql', 'mailtrain.sql'); let path = pathlib.join(__dirname, process.env.FROM_START ? 'base.sql' : 'mailtrain.sql');
applyUpdate({ applyUpdate({
path path
}, callback); }, callback);
@ -108,7 +108,7 @@ function runUpdates(callback) {
} }
if (!tables.settings) { if (!tables.settings) {
log.info('Initial', 'SQL not set up, initializing'); log.info('sql', 'SQL not set up, initializing');
return runInitial(callback); return runInitial(callback);
} }
@ -136,9 +136,9 @@ function runUpdates(callback) {
return callback(err); return callback(err);
} }
if (status) { if (status) {
log.info('Update', 'Update %s applied', update.seq); log.info('sql', 'Update %s applied', update.seq);
} else { } else {
log.info('Update', 'Update %s not applied', update.seq); log.info('sql', 'Update %s not applied', update.seq);
} }
runNext(); runNext();
@ -175,9 +175,9 @@ function applyUpdate(update, callback) {
runUpdates(err => { runUpdates(err => {
if (err) { if (err) {
log.error('RESULT', err); log.error('sql', err);
process.exit(1); process.exit(1);
} }
log.info('RESULT', 'SQL Upgrade Completed'); log.info('sql', 'Database update completed');
process.exit(0); process.exit(0);
}); });