parent
d7112909eb
commit
9291cbafdc
20
lib/mysql.js
20
lib/mysql.js
|
@ -26,15 +26,17 @@ exports.initialize = function initializeSchema(schema, callback) {
|
||||||
|
|
||||||
// schema.client.query('SET TIME_ZONE = "+04:00"', callback);
|
// schema.client.query('SET TIME_ZONE = "+04:00"', callback);
|
||||||
schema.client.query('USE `' + s.database + '`', function (err) {
|
schema.client.query('USE `' + s.database + '`', function (err) {
|
||||||
if (err && err.message.match(/(^|: )unknown database/i)) {
|
if (err) {
|
||||||
var dbName = s.database;
|
if (err.message.match(/(^|: )unknown database/i)) {
|
||||||
schema.client.query('CREATE DATABASE ' + dbName, function (error) {
|
var dbName = s.database;
|
||||||
if (!error) {
|
schema.client.query('CREATE DATABASE ' + dbName, function (error) {
|
||||||
schema.client.query('USE ' + s.database, callback);
|
if (!error) {
|
||||||
} else {
|
schema.client.query('USE ' + s.database, callback);
|
||||||
throw error;
|
} else {
|
||||||
}
|
throw error;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else throw error;
|
||||||
} else callback();
|
} else callback();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue