mirror of
https://github.com/knex/knex.git
synced 2025-10-01 11:06:51 +00:00
Fixed typo and moved LockError emitting to inside _getLock function
This commit is contained in:
parent
d510b2377f
commit
9236ca95e3
@ -169,10 +169,12 @@ export default class Migrator {
|
|||||||
return this._isLocked(trx)
|
return this._isLocked(trx)
|
||||||
.then(isLocked => {
|
.then(isLocked => {
|
||||||
if (isLocked) {
|
if (isLocked) {
|
||||||
throw new Error("Migration table is are already locked");
|
throw new Error("Migration table is already locked");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => this._lockMigrations(trx));
|
.then(() => this._lockMigrations(trx));
|
||||||
|
}).catch(err => {
|
||||||
|
throw new LockError(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,9 +187,6 @@ export default class Migrator {
|
|||||||
// Run a batch of current migrations, in sequence.
|
// Run a batch of current migrations, in sequence.
|
||||||
_runBatch(migrations, direction) {
|
_runBatch(migrations, direction) {
|
||||||
return this._getLock()
|
return this._getLock()
|
||||||
.catch(err => {
|
|
||||||
throw new LockError(err.message);
|
|
||||||
})
|
|
||||||
.then(() => Promise.all(_.map(migrations, this._validateMigrationStructure, this)))
|
.then(() => Promise.all(_.map(migrations, this._validateMigrationStructure, this)))
|
||||||
.then(() => this._latestBatchNumber())
|
.then(() => this._latestBatchNumber())
|
||||||
.then(batchNo => {
|
.then(batchNo => {
|
||||||
|
@ -153,7 +153,7 @@ module.exports = function(knex) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
expect(error).to.have.property('message', 'Migration table is are already locked');
|
expect(error).to.have.property('message', 'Migration table is already locked');
|
||||||
return knex('knex_migrations_lock').select('*');
|
return knex('knex_migrations_lock').select('*');
|
||||||
})
|
})
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user