Updated scripts for generating up-to-date sql setup file
This commit is contained in:
parent
03bed93643
commit
09ff342906
5 changed files with 68 additions and 41 deletions
|
@ -8,8 +8,9 @@
|
||||||
"test": "grunt",
|
"test": "grunt",
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"sqlinit": "node setup/sql/init.js",
|
"sqlinit": "node setup/sql/init.js",
|
||||||
"sqldump": "node setup/sql/dump.js | sed -e '/^--.*$/d' > setup/sql/mailtrain.sql",
|
"sqldump": "node setup/sql/dump.js | sed -e '/^\\/\\*.*\\*\\/;$/d' > setup/sql/mailtrain.sql",
|
||||||
"sqldrop": "node setup/sql/drop.js"
|
"sqldrop": "node setup/sql/drop.js",
|
||||||
|
"sqlgen": "npm run sqldrop && DB_FROM_START=Y npm run sqlinit && npm run sqldump"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
console.log('This script does not run in production'); // eslint-disable-line no-console
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
let config = require('config');
|
let config = require('config');
|
||||||
let spawn = require('child_process').spawn;
|
let spawn = require('child_process').spawn;
|
||||||
let log = require('npmlog');
|
let log = require('npmlog');
|
||||||
|
@ -29,15 +34,11 @@ function createDump(callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.CONFIRM === 'Y') {
|
createDump(err => {
|
||||||
createDump(err => {
|
if (err) {
|
||||||
if (err) {
|
log.error('sqldrop', err);
|
||||||
log.error('sqldrop', err);
|
process.exit(1);
|
||||||
process.exit(1);
|
}
|
||||||
}
|
log.info('sqldrop', 'Command completed, all tables dropped from "%s"', config.mysql.database);
|
||||||
log.info('sqldrop', 'Command completed, all tables dropped from "%s"', config.mysql.database);
|
process.exit(0);
|
||||||
process.exit(0);
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
log.error('sqldrop', 'Run command as "CONFIRM=Y npm run sqldrop"');
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
console.log('This script does not run in production'); // eslint-disable-line no-console
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
let config = require('config');
|
let config = require('config');
|
||||||
let spawn = require('child_process').spawn;
|
let spawn = require('child_process').spawn;
|
||||||
let log = require('npmlog');
|
let log = require('npmlog');
|
||||||
|
@ -7,7 +12,9 @@ let log = require('npmlog');
|
||||||
log.level = 'verbose';
|
log.level = 'verbose';
|
||||||
|
|
||||||
function createDump(callback) {
|
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]);
|
let cmd = spawn('mysqldump', ['-h', config.mysql.host || 'localhost', '-P', config.mysql.port || 3306, '-u', config.mysql.user, '-p' + config.mysql.password, '--skip-opt', '--quick', '--compact', '--complete-insert', '--create-options', '--tz-utc', '--no-set-names', '--skip-set-charset', '--skip-comments', config.mysql.database]);
|
||||||
|
|
||||||
|
process.stdout.write('SET UNIQUE_CHECKS=0;\nSET FOREIGN_KEY_CHECKS=0;\n\n');
|
||||||
|
|
||||||
cmd.stdout.pipe(process.stdout);
|
cmd.stdout.pipe(process.stdout);
|
||||||
cmd.stderr.pipe(process.stderr);
|
cmd.stderr.pipe(process.stderr);
|
||||||
|
@ -16,6 +23,9 @@ function createDump(callback) {
|
||||||
if (code) {
|
if (code) {
|
||||||
return callback(new Error('mysqldump command exited with code ' + code));
|
return callback(new Error('mysqldump command exited with code ' + code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.stdout.write('\nSET UNIQUE_CHECKS=1;\nSET FOREIGN_KEY_CHECKS=1;\n');
|
||||||
|
|
||||||
return callback(null, true);
|
return callback(null, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
console.log('This script does not run in production'); // eslint-disable-line no-console
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
let dbcheck = require('../../lib/dbcheck');
|
let dbcheck = require('../../lib/dbcheck');
|
||||||
let log = require('npmlog');
|
let log = require('npmlog');
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ CREATE TABLE `campaign` (
|
||||||
KEY `created` (`created`),
|
KEY `created` (`created`),
|
||||||
KEY `response_id` (`response_id`)
|
KEY `response_id` (`response_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `campaign_tracker` (
|
CREATE TABLE `campaign_tracker` (
|
||||||
`list` int(11) unsigned NOT NULL,
|
`list` int(11) unsigned NOT NULL,
|
||||||
`subscriber` int(11) unsigned NOT NULL,
|
`subscriber` int(11) unsigned NOT NULL,
|
||||||
|
@ -26,21 +25,23 @@ CREATE TABLE `campaign_tracker` (
|
||||||
`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=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `campaigns` (
|
CREATE TABLE `campaigns` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
||||||
|
`type` tinyint(4) unsigned NOT NULL DEFAULT '1',
|
||||||
`name` varchar(255) NOT NULL DEFAULT '',
|
`name` varchar(255) NOT NULL DEFAULT '',
|
||||||
`description` text,
|
`description` text,
|
||||||
`list` int(11) unsigned NOT NULL,
|
`list` int(11) unsigned NOT NULL,
|
||||||
`segment` int(11) unsigned DEFAULT NULL,
|
`segment` int(11) unsigned DEFAULT NULL,
|
||||||
`template` int(11) unsigned NOT NULL,
|
`template` int(11) unsigned NOT NULL,
|
||||||
|
`source_url` varchar(255) CHARACTER SET ascii DEFAULT NULL,
|
||||||
`from` varchar(255) DEFAULT '',
|
`from` varchar(255) DEFAULT '',
|
||||||
`address` varchar(255) DEFAULT '',
|
`address` varchar(255) DEFAULT '',
|
||||||
`subject` varchar(255) DEFAULT '',
|
`subject` varchar(255) DEFAULT '',
|
||||||
`html` text,
|
`html` text,
|
||||||
`text` text,
|
`text` text,
|
||||||
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
|
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
|
||||||
|
`scheduled` timestamp NULL DEFAULT NULL,
|
||||||
`status_change` timestamp NULL DEFAULT NULL,
|
`status_change` timestamp NULL DEFAULT NULL,
|
||||||
`delivered` int(11) unsigned NOT NULL DEFAULT '0',
|
`delivered` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
`opened` int(11) unsigned NOT NULL DEFAULT '0',
|
`opened` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
@ -52,9 +53,10 @@ CREATE TABLE `campaigns` (
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `cid` (`cid`),
|
UNIQUE KEY `cid` (`cid`),
|
||||||
KEY `name` (`name`(191)),
|
KEY `name` (`name`(191)),
|
||||||
KEY `status` (`status`)
|
KEY `status` (`status`),
|
||||||
|
KEY `schedule_index` (`scheduled`),
|
||||||
|
KEY `type_index` (`type`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `confirmations` (
|
CREATE TABLE `confirmations` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
||||||
|
@ -67,7 +69,6 @@ CREATE TABLE `confirmations` (
|
||||||
KEY `list` (`list`),
|
KEY `list` (`list`),
|
||||||
CONSTRAINT `confirmations_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
|
CONSTRAINT `confirmations_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
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,
|
||||||
|
@ -84,7 +85,6 @@ CREATE TABLE `custom_fields` (
|
||||||
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=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `import_failed` (
|
CREATE TABLE `import_failed` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`import` int(11) unsigned NOT NULL,
|
`import` int(11) unsigned NOT NULL,
|
||||||
|
@ -95,7 +95,6 @@ CREATE TABLE `import_failed` (
|
||||||
KEY `import` (`import`),
|
KEY `import` (`import`),
|
||||||
CONSTRAINT `import_failed_ibfk_1` FOREIGN KEY (`import`) REFERENCES `importer` (`id`) ON DELETE CASCADE
|
CONSTRAINT `import_failed_ibfk_1` FOREIGN KEY (`import`) REFERENCES `importer` (`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `importer` (
|
CREATE TABLE `importer` (
|
||||||
`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,
|
||||||
|
@ -106,6 +105,8 @@ CREATE TABLE `importer` (
|
||||||
`status` tinyint(4) unsigned NOT NULL DEFAULT '0',
|
`status` tinyint(4) unsigned NOT NULL DEFAULT '0',
|
||||||
`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',
|
||||||
|
`new` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`failed` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`mapping` text NOT NULL,
|
`mapping` text NOT NULL,
|
||||||
`finished` timestamp NULL DEFAULT NULL,
|
`finished` timestamp NULL DEFAULT NULL,
|
||||||
|
@ -113,7 +114,6 @@ CREATE TABLE `importer` (
|
||||||
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=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `links` (
|
CREATE TABLE `links` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`cid` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '',
|
`cid` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '',
|
||||||
|
@ -126,7 +126,6 @@ CREATE TABLE `links` (
|
||||||
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=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `lists` (
|
CREATE TABLE `lists` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
||||||
|
@ -138,7 +137,6 @@ CREATE TABLE `lists` (
|
||||||
UNIQUE KEY `cid` (`cid`),
|
UNIQUE KEY `cid` (`cid`),
|
||||||
KEY `name` (`name`(191))
|
KEY `name` (`name`(191))
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `segment_rules` (
|
CREATE TABLE `segment_rules` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`segment` int(11) unsigned NOT NULL,
|
`segment` int(11) unsigned NOT NULL,
|
||||||
|
@ -148,7 +146,6 @@ CREATE TABLE `segment_rules` (
|
||||||
KEY `segment` (`segment`),
|
KEY `segment` (`segment`),
|
||||||
CONSTRAINT `segment_rules_ibfk_1` FOREIGN KEY (`segment`) REFERENCES `segments` (`id`) ON DELETE CASCADE
|
CONSTRAINT `segment_rules_ibfk_1` FOREIGN KEY (`segment`) REFERENCES `segments` (`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `segments` (
|
CREATE TABLE `segments` (
|
||||||
`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,
|
||||||
|
@ -157,28 +154,40 @@ CREATE TABLE `segments` (
|
||||||
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `list` (`list`),
|
KEY `list` (`list`),
|
||||||
KEY `name` (`name`),
|
KEY `name` (`name`(191)),
|
||||||
CONSTRAINT `segments_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
|
CONSTRAINT `segments_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `settings` (
|
CREATE TABLE `settings` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`key` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '',
|
`key` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '',
|
||||||
`value` text NOT NULL,
|
`value` text NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `key` (`key`)
|
UNIQUE KEY `key` (`key`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4;
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (1,'smtp_hostname','localhost');
|
||||||
LOCK TABLES `settings` WRITE;
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (2,'smtp_port','465');
|
||||||
INSERT INTO `settings` VALUES (1,'smtp_hostname','localhost'),(2,'smtp_port','465'),(3,'smtp_encryption','TLS'),(4,'smtp_user','username'),(5,'smtp_pass','password'),(6,'service_url','http://localhost:3000/'),(7,'admin_email','admin@example.com'),(8,'smtp_max_connections','5'),(9,'smtp_max_messages','100'),(10,'smtp_log',''),(11,'default_sender','My Awesome Company'),(12,'default_postaddress','1234 Main Street'),(13,'default_from','My Awesome Company'),(14,'default_address','admin@example.com'),(15,'default_subject','Test message'),(16,'default_homepage','http://localhost:3000/'),(17,'db_schema_version','1');
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (3,'smtp_encryption','TLS');
|
||||||
UNLOCK TABLES;
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (4,'smtp_user','username');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (5,'smtp_pass','password');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (6,'service_url','http://localhost:3000/');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (7,'admin_email','admin@example.com');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (8,'smtp_max_connections','5');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (9,'smtp_max_messages','100');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (10,'smtp_log','');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (11,'default_sender','My Awesome Company');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (12,'default_postaddress','1234 Main Street');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (13,'default_from','My Awesome Company');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (14,'default_address','admin@example.com');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (15,'default_subject','Test message');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (16,'default_homepage','http://localhost:3000/');
|
||||||
|
INSERT INTO `settings` (`id`, `key`, `value`) VALUES (17,'db_schema_version','7');
|
||||||
CREATE TABLE `subscription` (
|
CREATE TABLE `subscription` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
`cid` varchar(255) CHARACTER SET ascii NOT NULL,
|
||||||
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
`email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||||
`opt_in_ip` varchar(100) DEFAULT NULL,
|
`opt_in_ip` varchar(100) DEFAULT NULL,
|
||||||
`opt_in_country` varchar(2) DEFAULT NULL,
|
`opt_in_country` varchar(2) DEFAULT NULL,
|
||||||
|
`tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,
|
||||||
`imported` int(11) unsigned DEFAULT NULL,
|
`imported` int(11) unsigned DEFAULT NULL,
|
||||||
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
|
`status` tinyint(4) unsigned NOT NULL DEFAULT '1',
|
||||||
`status_change` timestamp NULL DEFAULT NULL,
|
`status_change` timestamp NULL DEFAULT NULL,
|
||||||
|
@ -192,9 +201,9 @@ CREATE TABLE `subscription` (
|
||||||
UNIQUE KEY `cid` (`cid`),
|
UNIQUE KEY `cid` (`cid`),
|
||||||
KEY `status` (`status`),
|
KEY `status` (`status`),
|
||||||
KEY `first_name` (`first_name`(191)),
|
KEY `first_name` (`first_name`(191)),
|
||||||
KEY `last_name` (`last_name`(191))
|
KEY `last_name` (`last_name`(191)),
|
||||||
|
KEY `subscriber_tz` (`tz`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
CREATE TABLE `templates` (
|
CREATE TABLE `templates` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`name` varchar(255) NOT NULL DEFAULT '',
|
`name` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
@ -205,7 +214,11 @@ CREATE TABLE `templates` (
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `name` (`name`(191))
|
KEY `name` (`name`(191))
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
CREATE TABLE `tzoffset` (
|
||||||
|
`tz` varchar(100) NOT NULL DEFAULT '',
|
||||||
|
`offset` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`tz`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=ascii;
|
||||||
CREATE TABLE `users` (
|
CREATE TABLE `users` (
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`username` varchar(255) NOT NULL DEFAULT '',
|
`username` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
@ -220,10 +233,7 @@ CREATE TABLE `users` (
|
||||||
KEY `reset` (`reset_token`),
|
KEY `reset` (`reset_token`),
|
||||||
KEY `check_reset` (`username`(191),`reset_token`,`reset_expire`)
|
KEY `check_reset` (`username`(191),`reset_token`,`reset_expire`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
|
||||||
|
INSERT INTO `users` (`id`, `username`, `password`, `email`, `reset_token`, `reset_expire`, `created`) VALUES (1,'admin','$2a$10$mzKU71G62evnGB2PvQA4k..Wf9jASk.c7a8zRMHh6qQVjYJ2r/g/K','admin@example.com',NULL,NULL,'2016-05-01 17:15:46');
|
||||||
LOCK TABLES `users` WRITE;
|
|
||||||
INSERT INTO `users` VALUES (1,'admin','$2a$10$mzKU71G62evnGB2PvQA4k..Wf9jASk.c7a8zRMHh6qQVjYJ2r/g/K','admin@example.com',NULL,NULL,NOW());
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
SET UNIQUE_CHECKS=1;
|
SET UNIQUE_CHECKS=1;
|
||||||
SET FOREIGN_KEY_CHECKS=1;
|
SET FOREIGN_KEY_CHECKS=1;
|
||||||
|
|
Loading…
Reference in a new issue