knex 0.95.14 → 0.95.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Master (Unreleased)
2
2
 
3
+ # 0.95.15 - 22 December, 2021
4
+
5
+ ### Bug fixes:
6
+
7
+ - Oracle:
8
+ - MariaDB: lock row fix during migration in MariaDB and Oracle #4865
9
+
3
10
  # 0.95.14 - 09 November, 2021
4
11
 
5
12
  ### Bug fixes:
@@ -327,7 +327,7 @@ class Migrator {
327
327
  .where('is_locked', '=', 0)
328
328
  .update({ is_locked: 1 })
329
329
  .then((rowCount) => {
330
- if (rowCount != 1) {
330
+ if (rowCount !== 1) {
331
331
  throw new Error('Migration table is already locked');
332
332
  }
333
333
  });
@@ -55,11 +55,12 @@ function _createMigrationLockTable(tableName, schemaName, trxOrKnex) {
55
55
  function _insertLockRowIfNeeded(tableName, schemaName, trxOrKnex) {
56
56
  const lockTableWithSchema = getLockTableNameWithSchema(tableName, schemaName);
57
57
  return trxOrKnex
58
- .from(trxOrKnex.raw('?? (??)', [lockTableWithSchema, 'is_locked']))
59
- .insert(function () {
60
- return this.select(trxOrKnex.raw('?', [0])).whereNotExists(function () {
61
- return this.select('*').from(lockTableWithSchema);
62
- });
58
+ .select('*')
59
+ .from(lockTableWithSchema)
60
+ .then((data) => {
61
+ return !data.length
62
+ ? trxOrKnex.from(lockTableWithSchema).insert({ is_locked: 0 })
63
+ : null;
63
64
  });
64
65
  }
65
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knex",
3
- "version": "0.95.14",
3
+ "version": "0.95.15",
4
4
  "description": "A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3",
5
5
  "main": "knex",
6
6
  "types": "types/index.d.ts",