upgrade eslint deps
This commit is contained in:
parent
5eedce280e
commit
7a7a34e77f
|
@ -203,8 +203,8 @@ function mixinDiscovery(MySQL, mysql) {
|
|||
* @param table
|
||||
* @returns {string}
|
||||
*/
|
||||
// http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html
|
||||
// #getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
|
||||
// http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html
|
||||
// #getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
|
||||
MySQL.prototype.buildQueryPrimaryKeys = function(schema, table) {
|
||||
var sql = 'SELECT table_schema AS "owner",' +
|
||||
' table_name AS "tableName",' +
|
||||
|
|
|
@ -67,14 +67,15 @@ function mixinMigration(MySQL, mysql) {
|
|||
|
||||
self.getTableStatus(model, function(err, fields, indexes) {
|
||||
self.discoverForeignKeys(self.table(model), {}, function(err, foreignKeys) {
|
||||
if (err) console.log('Failed to discover "' + table + '" foreign keys', err);
|
||||
if (err) console.log('Failed to discover "' + self.table(model) +
|
||||
'" foreign keys', err);
|
||||
|
||||
if (!err && fields && fields.length) {
|
||||
//if we already have a definition, update this table
|
||||
// if we already have a definition, update this table
|
||||
self.alterTable(model, fields, indexes, foreignKeys, function(err, result) {
|
||||
if (!err) {
|
||||
//foreignKeys is a list of EXISTING fkeys here, so you don't need to recreate them again
|
||||
//prepare fkSQL for new foreign keys
|
||||
// foreignKeys is a list of EXISTING fkeys here, so you don't need to recreate them again
|
||||
// prepare fkSQL for new foreign keys
|
||||
var fkSQL = self.getForeignKeySQL(model,
|
||||
self.getModelDefinition(model).settings.foreignKeys,
|
||||
foreignKeys);
|
||||
|
@ -86,7 +87,7 @@ function mixinMigration(MySQL, mysql) {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
//if there is not yet a definition, create this table
|
||||
// if there is not yet a definition, create this table
|
||||
self.createTable(model, function(err) {
|
||||
if (!err) {
|
||||
self.addForeignKeys(model, function(err, result) {
|
||||
|
@ -144,7 +145,8 @@ function mixinMigration(MySQL, mysql) {
|
|||
async.eachSeries(models, function(model, done) {
|
||||
self.getTableStatus(model, function(err, fields, indexes) {
|
||||
self.discoverForeignKeys(self.table(model), {}, function(err, foreignKeys) {
|
||||
if (err) console.log('Failed to discover "' + table + '" foreign keys', err);
|
||||
if (err) console.log('Failed to discover "' + self.table(model) +
|
||||
'" foreign keys', err);
|
||||
|
||||
self.alterTable(model, fields, indexes, foreignKeys, function(err, needAlter) {
|
||||
if (err) {
|
||||
|
@ -289,14 +291,14 @@ function mixinMigration(MySQL, mysql) {
|
|||
// second: check multiple indexes
|
||||
var orderMatched = true;
|
||||
if (indexNames.indexOf(indexName) !== -1) {
|
||||
//check if indexes are configured as "columns"
|
||||
// check if indexes are configured as "columns"
|
||||
if (m.settings.indexes[indexName].columns) {
|
||||
m.settings.indexes[indexName].columns.split(/,\s*/).forEach(
|
||||
function(columnName, i) {
|
||||
if (ai[indexName].columns[i] !== columnName) orderMatched = false;
|
||||
});
|
||||
} else if (m.settings.indexes[indexName].keys) {
|
||||
//if indexes are configured as "keys"
|
||||
// if indexes are configured as "keys"
|
||||
var index = 0;
|
||||
for (var key in m.settings.indexes[indexName].keys) {
|
||||
var sortOrder = m.settings.indexes[indexName].keys[key];
|
||||
|
@ -306,7 +308,7 @@ function mixinMigration(MySQL, mysql) {
|
|||
}
|
||||
index++;
|
||||
}
|
||||
//if number of columns differ between new and old index
|
||||
// if number of columns differ between new and old index
|
||||
if (index !== ai[indexName].columns.length) {
|
||||
orderMatched = false;
|
||||
}
|
||||
|
@ -361,13 +363,13 @@ function mixinMigration(MySQL, mysql) {
|
|||
if (i.kind) {
|
||||
kind = i.kind;
|
||||
} else if (i.options && i.options.unique && i.options.unique == true) {
|
||||
//if index unique indicator is configured
|
||||
// if index unique indicator is configured
|
||||
kind = 'UNIQUE';
|
||||
}
|
||||
|
||||
var indexedColumns = [];
|
||||
var columns = '';
|
||||
//if indexes are configured as "keys"
|
||||
// if indexes are configured as "keys"
|
||||
if (i.keys) {
|
||||
for (var key in i.keys) {
|
||||
if (i.keys[key] !== -1) {
|
||||
|
@ -380,7 +382,7 @@ function mixinMigration(MySQL, mysql) {
|
|||
if (indexedColumns.length > 0) {
|
||||
columns = indexedColumns.join(',');
|
||||
} else if (i.columns) {
|
||||
//if indexes are configured as "columns"
|
||||
// if indexes are configured as "columns"
|
||||
columns = i.columns;
|
||||
}
|
||||
if (kind && type) {
|
||||
|
@ -404,8 +406,8 @@ function mixinMigration(MySQL, mysql) {
|
|||
if (actualFks) {
|
||||
var keys = Object.keys(actualFks);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
//all existing fks are already checked in MySQL.prototype.dropForeignKeys
|
||||
//so we need check only names - skip if found
|
||||
// all existing fks are already checked in MySQL.prototype.dropForeignKeys
|
||||
// so we need check only names - skip if found
|
||||
if (existingFks.filter(function(fk) {
|
||||
return fk.fkName === keys[i];
|
||||
}).length > 0) continue;
|
||||
|
@ -450,7 +452,7 @@ function mixinMigration(MySQL, mysql) {
|
|||
var sql = [];
|
||||
var correctFks = m.settings.foreignKeys || {};
|
||||
|
||||
//drop foreign keys for removed fields
|
||||
// drop foreign keys for removed fields
|
||||
if (fks && fks.length) {
|
||||
var removedFks = [];
|
||||
fks.forEach(function(fk) {
|
||||
|
@ -471,11 +473,11 @@ function mixinMigration(MySQL, mysql) {
|
|||
|
||||
if (needsToDrop) {
|
||||
sql.push('DROP FOREIGN KEY ' + fk.fkName);
|
||||
removedFks.push(fk); //keep track that we removed these
|
||||
removedFks.push(fk); // keep track that we removed these
|
||||
}
|
||||
});
|
||||
|
||||
//update out list of existing keys by removing dropped keys
|
||||
// update out list of existing keys by removing dropped keys
|
||||
removedFks.forEach(function(k) {
|
||||
var index = actualFks.indexOf(k);
|
||||
if (index !== -1) actualFks.splice(index, 1);
|
||||
|
@ -491,7 +493,7 @@ function mixinMigration(MySQL, mysql) {
|
|||
};
|
||||
|
||||
MySQL.prototype.alterTable = function(model, actualFields, actualIndexes, actualFks, done, checkOnly) {
|
||||
//if this is using an old signature, then grab the correct callback and check boolean
|
||||
// if this is using an old signature, then grab the correct callback and check boolean
|
||||
if ('function' == typeof actualFks && typeof done !== 'function') {
|
||||
checkOnly = done || false;
|
||||
done = actualFks;
|
||||
|
@ -520,25 +522,25 @@ function mixinMigration(MySQL, mysql) {
|
|||
], function(err, result) {
|
||||
if (err) done(err);
|
||||
|
||||
//determine if there are column, index, or foreign keys changes (all require update)
|
||||
// determine if there are column, index, or foreign keys changes (all require update)
|
||||
if (statements.length) {
|
||||
//get the required alter statements
|
||||
// get the required alter statements
|
||||
var alterStmt = self.getAlterStatement(model, statements);
|
||||
var stmtList = [alterStmt];
|
||||
|
||||
//set up an object to pass back all changes, changes that have been run,
|
||||
//and foreign key statements that haven't been run
|
||||
// set up an object to pass back all changes, changes that have been run,
|
||||
// and foreign key statements that haven't been run
|
||||
var retValues = {
|
||||
statements: stmtList,
|
||||
query: stmtList.join(';'),
|
||||
};
|
||||
|
||||
//if we're running in read only mode OR if the only changes are foreign keys additions,
|
||||
//then just return the object directly
|
||||
// if we're running in read only mode OR if the only changes are foreign keys additions,
|
||||
// then just return the object directly
|
||||
if (checkOnly) {
|
||||
done(null, true, retValues);
|
||||
} else {
|
||||
//if there are changes in the alter statement, then execute them and return the object
|
||||
// if there are changes in the alter statement, then execute them and return the object
|
||||
self.execute(alterStmt, function(err) {
|
||||
done(err, true, retValues);
|
||||
});
|
||||
|
@ -554,10 +556,10 @@ function mixinMigration(MySQL, mysql) {
|
|||
|
||||
var fk = definition.settings.foreignKeys[keyName];
|
||||
if (fk) {
|
||||
//get the definition of the referenced object
|
||||
// get the definition of the referenced object
|
||||
var fkEntityName = (typeof fk.entity === 'object') ? fk.entity.name : fk.entity;
|
||||
|
||||
//verify that the other model in the same DB
|
||||
// verify that the other model in the same DB
|
||||
if (this._models[fkEntityName]) {
|
||||
return ' CONSTRAINT ' + this.client.escapeId(fk.name) +
|
||||
' FOREIGN KEY (`' + expectedColNameForModel(fk.foreignKey, definition) + '`)' +
|
||||
|
@ -648,24 +650,24 @@ function mixinMigration(MySQL, mysql) {
|
|||
type = 'USING ' + i.type;
|
||||
}
|
||||
if (i.kind) {
|
||||
//if index uniqueness is configured as "kind"
|
||||
// if index uniqueness is configured as "kind"
|
||||
kind = i.kind;
|
||||
} else if (i.options && i.options.unique && i.options.unique == true) {
|
||||
//if index unique indicator is configured
|
||||
// if index unique indicator is configured
|
||||
kind = 'UNIQUE';
|
||||
}
|
||||
var indexedColumns = [];
|
||||
var indexName = this.escapeName(index);
|
||||
var columns = '';
|
||||
//if indexes are configured as "keys"
|
||||
// if indexes are configured as "keys"
|
||||
if (i.keys) {
|
||||
//for each field in "keys" object
|
||||
// for each field in "keys" object
|
||||
for (var key in i.keys) {
|
||||
if (i.keys[key] !== -1) {
|
||||
indexedColumns.push(this.escapeName(key));
|
||||
} else {
|
||||
//mysql does not support index sorting Currently
|
||||
//but mysql has added DESC keyword for future support
|
||||
// mysql does not support index sorting Currently
|
||||
// but mysql has added DESC keyword for future support
|
||||
indexedColumns.push(this.escapeName(key) + ' DESC ');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -345,8 +345,8 @@ MySQL.prototype.toColumnValue = function(prop, val) {
|
|||
}
|
||||
return castNull;
|
||||
} catch (err) {
|
||||
//if we can't coerce null to a certain type,
|
||||
//we just return it
|
||||
// if we can't coerce null to a certain type,
|
||||
// we just return it
|
||||
return 'null';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"bluebird": "~2.9.10",
|
||||
"eslint": "^2.13.1",
|
||||
"eslint-config-loopback": "^4.0.0",
|
||||
"eslint": "^4.3.0",
|
||||
"eslint-config-loopback": "^8.0.0",
|
||||
"loopback-datasource-juggler": "^3.0.0",
|
||||
"mocha": "^2.1.0",
|
||||
"rc": "^1.0.0",
|
||||
|
|
|
@ -19,7 +19,8 @@ describe('connections', function() {
|
|||
|
||||
config = global.getConfig();
|
||||
|
||||
odb = getDataSource({collation: 'utf8_general_ci', createDatabase: true});
|
||||
odb = global.getDataSource({collation: 'utf8_general_ci',
|
||||
createDatabase: true});
|
||||
db = odb;
|
||||
});
|
||||
|
||||
|
@ -53,7 +54,7 @@ describe('connections', function() {
|
|||
|
||||
it('should disconnect first db', function(done) {
|
||||
db.disconnect(function() {
|
||||
odb = getDataSource();
|
||||
odb = global.getDataSource();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -112,7 +113,8 @@ function charsetTest(test_set, test_collo, test_set_str, test_set_collo, done) {
|
|||
query('DROP DATABASE IF EXISTS ' + odb.settings.database, function(err) {
|
||||
assert.ok(!err);
|
||||
odb.disconnect(function() {
|
||||
db = getDataSource({collation: test_set_collo, createDatabase: true});
|
||||
db = global.getDataSource({collation: test_set_collo,
|
||||
createDatabase: true});
|
||||
DummyModel = db.define('DummyModel', {string: String});
|
||||
db.automigrate(function() {
|
||||
var q = 'SELECT DEFAULT_COLLATION_NAME' +
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('MySQL specific datatypes', function() {
|
|||
];
|
||||
before(function(done) {
|
||||
require('./init.js');
|
||||
db = getSchema();
|
||||
db = global.getSchema();
|
||||
Account = db.define('Account', {
|
||||
type: {type: String},
|
||||
amount: {
|
||||
|
@ -233,7 +233,7 @@ describe('MySQL specific datatypes', function() {
|
|||
function setup(done) {
|
||||
require('./init.js');
|
||||
|
||||
db = getSchema();
|
||||
db = global.getSchema();
|
||||
|
||||
ANIMAL_ENUM = db.EnumFactory('dog', 'cat', 'mouse');
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('MySQL datetime handling', function() {
|
|||
});
|
||||
}
|
||||
before(function(done) {
|
||||
db = getSchema({
|
||||
db = global.getSchema({
|
||||
dateStrings: true,
|
||||
});
|
||||
Person = db.define('Person', personDefinition, {forceId: true, strict: true});
|
||||
|
|
|
@ -30,7 +30,7 @@ global.getConfig = function(options) {
|
|||
};
|
||||
|
||||
global.getDataSource = global.getSchema = function(options) {
|
||||
var db = new DataSource(require('../'), getConfig(options));
|
||||
var db = new DataSource(require('../'), global.getConfig(options));
|
||||
return db;
|
||||
};
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ describe('migrations', function() {
|
|||
next();
|
||||
});
|
||||
}, function(next) {
|
||||
//Minimum value for unsigned mediumInt is 0
|
||||
// Minimum value for unsigned mediumInt is 0
|
||||
NumberData.create({number: 1.1234567, mediumInt: -8388608}, function(err, obj) {
|
||||
assert(err);
|
||||
assert.equal(err.code, 'ER_WARN_DATA_OUT_OF_RANGE');
|
||||
|
@ -468,7 +468,7 @@ describe('migrations', function() {
|
|||
function setup(done) {
|
||||
require('./init.js');
|
||||
|
||||
db = getSchema();
|
||||
db = global.getSchema();
|
||||
|
||||
UserData = db.define('UserData', {
|
||||
email: {type: String, null: false, index: true},
|
||||
|
|
|
@ -9,7 +9,7 @@ require('./init');
|
|||
var ds;
|
||||
|
||||
before(function() {
|
||||
ds = getDataSource();
|
||||
ds = global.getDataSource();
|
||||
});
|
||||
|
||||
describe('MySQL connector', function() {
|
||||
|
@ -18,7 +18,7 @@ describe('MySQL connector', function() {
|
|||
});
|
||||
|
||||
describe('escape index names upon automigrate', function() {
|
||||
before (function(done) {
|
||||
before(function(done) {
|
||||
var messageSchema = {
|
||||
'name': 'Message',
|
||||
'options': {
|
||||
|
@ -260,7 +260,7 @@ describe('MySQL connector', function() {
|
|||
assert.equal(updatedindexes[1].Key_name, 'customer_code');
|
||||
assert.equal(updatedindexes[2].Key_name, 'updated_name_index');
|
||||
assert.equal(updatedindexes[3].Key_name, 'updated_name_index');
|
||||
//Mysql supports only index sorting in ascending; DESC is ignored
|
||||
// Mysql supports only index sorting in ascending; DESC is ignored
|
||||
assert.equal(updatedindexes[1].Collation, 'A');
|
||||
assert.equal(updatedindexes[2].Collation, 'A');
|
||||
assert.equal(updatedindexes[3].Collation, 'A');
|
||||
|
@ -453,17 +453,17 @@ describe('MySQL connector', function() {
|
|||
ds.createModel(customer3_schema.name, customer3_schema.properties, customer3_schema.options);
|
||||
ds.createModel(schema_v1.name, schema_v1.properties, schema_v1.options);
|
||||
|
||||
//do initial update/creation of table
|
||||
// do initial update/creation of table
|
||||
ds.autoupdate(function(err) {
|
||||
assert(!err, err);
|
||||
ds.discoverModelProperties('order_test', function(err, props) {
|
||||
//validate that we have the correct number of properties
|
||||
// validate that we have the correct number of properties
|
||||
assert.equal(props.length, 3);
|
||||
|
||||
//get the foreign keys for this table
|
||||
// get the foreign keys for this table
|
||||
ds.connector.execute(foreignKeySelect, function(err, foreignKeys) {
|
||||
if (err) return done(err);
|
||||
//validate that the foreign key exists and points to the right column
|
||||
// validate that the foreign key exists and points to the right column
|
||||
assert(foreignKeys);
|
||||
assert(foreignKeys.length.should.be.equal(1));
|
||||
assert.equal(foreignKeys[0].REFERENCED_TABLE_NAME, 'customer_test3');
|
||||
|
@ -471,26 +471,26 @@ describe('MySQL connector', function() {
|
|||
assert.equal(foreignKeys[0].CONSTRAINT_NAME, 'fk_ordertest_customerId');
|
||||
assert.equal(foreignKeys[0].REFERENCED_COLUMN_NAME, 'id');
|
||||
|
||||
//update our model (move foreign key) and run autoupdate to migrate
|
||||
// update our model (move foreign key) and run autoupdate to migrate
|
||||
ds.createModel(schema_v2.name, schema_v2.properties, schema_v2.options);
|
||||
ds.autoupdate(function(err, result) {
|
||||
if (err) return done(err);
|
||||
|
||||
//should be actual after autoupdate
|
||||
// should be actual after autoupdate
|
||||
ds.isActual(function(err, isEqual) {
|
||||
if (err) return done(err);
|
||||
assert(!isEqual);
|
||||
|
||||
//get and validate the properties on this model
|
||||
// get and validate the properties on this model
|
||||
ds.discoverModelProperties('order_test', function(err, props) {
|
||||
if (err) return done(err);
|
||||
|
||||
assert.equal(props.length, 3);
|
||||
|
||||
//get the foreign keys that exist after the migration
|
||||
// get the foreign keys that exist after the migration
|
||||
ds.connector.execute(foreignKeySelect, function(err, updatedForeignKeys) {
|
||||
if (err) return done(err);
|
||||
//validate that the foreign keys was moved to the new column
|
||||
// validate that the foreign keys was moved to the new column
|
||||
assert(updatedForeignKeys);
|
||||
assert(updatedForeignKeys.length.should.be.equal(1));
|
||||
assert.equal(updatedForeignKeys[0].REFERENCED_TABLE_NAME, 'customer_test2');
|
||||
|
@ -498,17 +498,17 @@ describe('MySQL connector', function() {
|
|||
assert.equal(updatedForeignKeys[0].CONSTRAINT_NAME, 'fk_ordertest_customerId');
|
||||
assert.equal(updatedForeignKeys[0].REFERENCED_COLUMN_NAME, 'id');
|
||||
|
||||
//update model (to drop foreign key) and autoupdate
|
||||
// update model (to drop foreign key) and autoupdate
|
||||
ds.createModel(schema_v3.name, schema_v3.properties, schema_v3.options);
|
||||
ds.autoupdate(function(err, result) {
|
||||
if (err) return done(err);
|
||||
//validate the properties
|
||||
// validate the properties
|
||||
ds.discoverModelProperties('order_test', function(err, props) {
|
||||
if (err) return done(err);
|
||||
|
||||
assert.equal(props.length, 3);
|
||||
|
||||
//get the foreign keys and validate the foreign key has been dropped
|
||||
// get the foreign keys and validate the foreign key has been dropped
|
||||
ds.connector.execute(foreignKeySelect, function(err, thirdForeignKeys) {
|
||||
if (err) return done(err);
|
||||
assert(thirdForeignKeys);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
'use strict';
|
||||
process.env.NODE_ENV = 'test';
|
||||
require('should');
|
||||
var should = require('should');
|
||||
|
||||
var assert = require('assert');
|
||||
var DataSource = require('loopback-datasource-juggler').DataSource;
|
||||
|
@ -13,7 +13,7 @@ var db, config;
|
|||
|
||||
before(function(done) {
|
||||
require('./init');
|
||||
config = getConfig();
|
||||
config = global.getConfig();
|
||||
config.database = 'STRONGLOOP';
|
||||
db = new DataSource(require('../'), config);
|
||||
db.once('connected', done);
|
||||
|
@ -43,7 +43,7 @@ describe('discoverModels', function() {
|
|||
done(err);
|
||||
} else {
|
||||
var views = false;
|
||||
should.assert(models.length > 0, 'some models returned');
|
||||
assert(models.length > 0, 'some models returned');
|
||||
models.forEach(function(m) {
|
||||
if (m.type === 'view') {
|
||||
views = true;
|
||||
|
@ -67,7 +67,7 @@ describe('discoverModels', function() {
|
|||
done(err);
|
||||
} else {
|
||||
var views = false;
|
||||
should.assert(models.length > 0, 'some models returned');
|
||||
assert(models.length > 0, 'some models returned');
|
||||
models.forEach(function(m) {
|
||||
assert.equal(m.schema.toLowerCase(), config.database.toLowerCase());
|
||||
});
|
||||
|
@ -88,9 +88,9 @@ describe('discoverModels', function() {
|
|||
console.error(err);
|
||||
done(err);
|
||||
} else {
|
||||
should.assert(models.length > 0, 'some models returned');
|
||||
assert(models.length > 0, 'some models returned');
|
||||
models.forEach(function(m) {
|
||||
should.not.equal(m.type, 'view', 'model type should not be a view');
|
||||
should.notEqual(m.type, 'view', 'model type should not be a view');
|
||||
});
|
||||
done(null, models);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
'use strict';
|
||||
var should = require('./init.js');
|
||||
var sinon = require('sinon');
|
||||
|
||||
var Post, PostWithStringId, PostWithUniqueTitle, PostWithNumId, db;
|
||||
|
||||
|
@ -23,7 +24,7 @@ ObjectID.prototype.toJSON = function() {
|
|||
|
||||
describe('mysql', function() {
|
||||
before(function(done) {
|
||||
db = getDataSource();
|
||||
db = global.getDataSource();
|
||||
|
||||
Post = db.define('PostWithDefaultId', {
|
||||
title: {type: String, length: 255, index: true},
|
||||
|
@ -257,7 +258,8 @@ describe('mysql', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('save should update the instance without removing existing properties', function(done) {
|
||||
it('save should update the instance without removing existing properties',
|
||||
function(done) {
|
||||
Post.create({title: 'a', content: 'AAA'}, function(err, post) {
|
||||
delete post.title;
|
||||
post.save(function(err, p) {
|
||||
|
@ -270,7 +272,6 @@ describe('mysql', function() {
|
|||
|
||||
p.content.should.be.equal(post.content);
|
||||
p.title.should.be.equal('a');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -15,7 +15,8 @@ var db, Post, Review;
|
|||
|
||||
describe('transactions with promise', function() {
|
||||
before(function(done) {
|
||||
db = getDataSource({collation: 'utf8_general_ci', createDatabase: true});
|
||||
db = global.getDataSource({collation: 'utf8_general_ci',
|
||||
createDatabase: true});
|
||||
db.once('connected', function() {
|
||||
Post = db.define('PostTX', {
|
||||
title: {type: String, length: 255, index: true},
|
||||
|
@ -82,8 +83,8 @@ describe('transactions with promise', function() {
|
|||
};
|
||||
}
|
||||
|
||||
// Return an async function to find matching posts and assert number of
|
||||
// records to equal to the count
|
||||
// Return an async function to find matching posts and assert number of
|
||||
// records to equal to the count
|
||||
function expectToFindPosts(where, count, inTx) {
|
||||
return function(done) {
|
||||
var options = {};
|
||||
|
|
|
@ -12,7 +12,8 @@ var db, Post, Review;
|
|||
|
||||
describe('transactions', function() {
|
||||
before(function(done) {
|
||||
db = getDataSource({collation: 'utf8_general_ci', createDatabase: true});
|
||||
db = global.getDataSource({collation: 'utf8_general_ci',
|
||||
createDatabase: true});
|
||||
db.once('connected', function() {
|
||||
Post = db.define('PostTX', {
|
||||
title: {type: String, length: 255, index: true},
|
||||
|
|
Loading…
Reference in New Issue