knex 1.0.1 → 1.0.4

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,75 @@
1
1
  # Master (Unreleased)
2
2
 
3
+ # 1.0.4 - 13 March, 2022
4
+
5
+ ### New features:
6
+
7
+ - Add whereLike functions #5044
8
+
9
+ ### Bug fixes:
10
+
11
+ - Fix orWhereJsonPath clause #5022
12
+ - Subquery in on clause missing parenthesis #5049
13
+ - Rework Union Wrapping #5030
14
+ - Oracle: Fix batch inserts with DEFAULT values with OracleDB #2592 #5037
15
+
16
+ ### Typings:
17
+
18
+ - Fix types for "returning" methods #5031
19
+ - createTableLike callback should be optional #5055
20
+
21
+ ### Documentation:
22
+
23
+ - Website URL changed to https://knex.github.io/documentation/
24
+
25
+ # 1.0.3 - 11 February, 2022
26
+
27
+ ### Bug fixes:
28
+
29
+ - Fix error message for missing migration files #4937
30
+ - Add withMaterialized and withNotMaterialized to method-constants #5009
31
+ - PostgreSQL: Fix whereJsonPath queries #5011
32
+ - PostgreSQL: Fix delete joins #5016
33
+ - CockroachDB: Fix whereJsonPath queries #5011
34
+ - MySQL: Create primary keys in same statement #5017
35
+
36
+ ### Typings:
37
+
38
+ - Fix type definition for getMigration in MigrationSource #4998
39
+ - Fix argument type of alter method #4996
40
+
41
+ ### Improvements:
42
+
43
+ - Use async / await syntax in seeds as default #5005
44
+
45
+ ### Documentation:
46
+
47
+ - Add Firebird dialect to ECOSYSTEM.md #5003
48
+
49
+ # 1.0.2 - 02 February, 2022
50
+
51
+ ### New features:
52
+
53
+ - Support of MATERIALIZED and NOT MATERIALIZED with WITH/CTE #4940
54
+ - Add raw support in onConflict clause #4960
55
+ - Alter nullable constraint when alterNullable is set to true #4730
56
+ - Add alterType parameter for alter function #4967
57
+ - Support string json in json values #4988
58
+ - MySQL: add with clause #4508
59
+
60
+ ### Bug fixes:
61
+
62
+ - Fix error message for missing migration files #4937
63
+ - Move deferrable to after on update/on delete #4976
64
+ - Do not use sys.tables to find if a table exists #2328
65
+ - PostgreSQL: Fix Order nulls #4989
66
+ - MySQL: Fix collation when renaming column #2666
67
+ - SQLite: Same boolean handling in better-sqlite3 as in sqlite3 #4982
68
+
69
+ ### Typings:
70
+
71
+ - WhereILike - fix typo #4941
72
+
3
73
  # 1.0.1 - 16 January, 2022
4
74
 
5
75
  ### Bug fixes:
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [knex.js](http://knexjs.org)
1
+ # [knex.js](https://knex.github.io/documentation/)
2
2
 
3
3
  [![npm version](http://img.shields.io/npm/v/knex.svg)](https://npmjs.org/package/knex)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/knex.svg)](https://npmjs.org/package/knex)
@@ -13,15 +13,15 @@
13
13
  A batteries-included, multi-dialect (PostgreSQL, MySQL, CockroachDB, MSSQL, SQLite3, Oracle (including Oracle Wallet Authentication)) query builder for
14
14
  Node.js, featuring:
15
15
 
16
- - [transactions](https://knexjs.org/#Transactions)
17
- - [connection pooling](https://knexjs.org/#Installation-pooling)
18
- - [streaming queries](https://knexjs.org/#Interfaces-Streams)
19
- - both a [promise](https://knexjs.org/#Interfaces-Promises) and [callback](https://knexjs.org/#Interfaces-Callbacks) API
16
+ - [transactions](https://knex.github.io/documentation/#Transactions)
17
+ - [connection pooling](https://knex.github.io/documentation/#Installation-pooling)
18
+ - [streaming queries](https://knex.github.io/documentation/#Interfaces-Streams)
19
+ - both a [promise](https://knex.github.io/documentation/#Interfaces-Promises) and [callback](https://knex.github.io/documentation/#Interfaces-Callbacks) API
20
20
  - a [thorough test suite](https://github.com/knex/knex/actions)
21
21
 
22
22
  Node.js versions 12+ are supported.
23
23
 
24
- * Take a look at the [full documentation](https://knexjs.org) to get started!
24
+ * Take a look at the [full documentation](https://knex.github.io/documentation) to get started!
25
25
  * Browse the [list of plugins and tools](https://github.com/knex/knex/blob/master/ECOSYSTEM.md) built for knex
26
26
  * Check out our [recipes wiki](https://github.com/knex/knex/wiki/Recipes) to search for solutions to some specific problems
27
27
  * In case of upgrading from an older version, see [migration guide](https://github.com/knex/knex/blob/master/UPGRADING.md)
package/UPGRADING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ### Upgrading to version 1.0.0+
4
4
 
5
5
  * Node.js older than 12 is no longer supported, make sure to update your environment;
6
- * If you are using `sqlite3` driver, please replace it with `@vscode/sqlite3`;
6
+ * If you are using `sqlite3` driver dependency, please replace it with `@vscode/sqlite3` in your `package.json`;
7
7
  * `RETURNING` operations now always return an object with column names;
8
8
  * Migrator now returns list of migrations as objects.
9
9
 
@@ -56,7 +56,7 @@ class Client_BetterSQLite3 extends Client_SQLite3 {
56
56
  }
57
57
 
58
58
  if (typeof binding === 'boolean') {
59
- return String(binding);
59
+ return Number(binding);
60
60
  }
61
61
 
62
62
  return binding;
@@ -28,11 +28,16 @@ class QueryCompiler_CRDB extends QueryCompiler_PG {
28
28
  return body === '' ? '' : sql + body;
29
29
  }
30
30
 
31
+ _groupOrder(item, type) {
32
+ // CockroachDB don't support PostgreSQL order nulls first/last syntax, we take the generic one.
33
+ return this._basicGroupOrder(item, type);
34
+ }
35
+
31
36
  whereJsonPath(statement) {
32
37
  let castValue = '';
33
- if (parseInt(statement.value)) {
38
+ if (!isNaN(statement.value) && parseInt(statement.value)) {
34
39
  castValue = '::int';
35
- } else if (parseFloat(statement.value)) {
40
+ } else if (!isNaN(statement.value) && parseFloat(statement.value)) {
36
41
  castValue = '::float';
37
42
  } else {
38
43
  castValue = " #>> '{}'";
@@ -45,14 +45,13 @@ class SchemaCompiler_MSSQL extends SchemaCompiler {
45
45
  // Check whether a table exists on the query.
46
46
  hasTable(tableName) {
47
47
  const formattedTable = this.client.parameter(
48
- this.formatter.wrap(prefixedTableName(this.schema, tableName)),
48
+ prefixedTableName(this.schema, tableName),
49
49
  this.builder,
50
50
  this.bindingsHolder
51
51
  );
52
-
53
52
  const sql =
54
- `select object_id from sys.tables ` +
55
- `where object_id = object_id(${formattedTable})`;
53
+ `SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ` +
54
+ `WHERE TABLE_NAME = ${formattedTable}`;
56
55
  this.pushQuery({ sql, output: (resp) => resp.length > 0 });
57
56
  }
58
57
 
@@ -80,12 +80,14 @@ class QueryCompiler_MySQL extends QueryCompiler {
80
80
 
81
81
  // Update method, including joins, wheres, order & limits.
82
82
  update() {
83
+ const withSQL = this.with();
83
84
  const join = this.join();
84
85
  const updates = this._prepUpdate(this.single.update);
85
86
  const where = this.where();
86
87
  const order = this.order();
87
88
  const limit = this.limit();
88
89
  return (
90
+ withSQL +
89
91
  `update ${this.tableName}` +
90
92
  (join ? ` ${join}` : '') +
91
93
  ' set ' +
@@ -19,7 +19,12 @@ class TableCompiler_MySQL extends TableCompiler {
19
19
  : 'create table ';
20
20
  const { client } = this;
21
21
  let conn = {};
22
- const columnsSql = ' (' + columns.sql.join(', ') + this._addChecks() + ')';
22
+ let columnsSql = ' (' + columns.sql.join(', ');
23
+
24
+ columnsSql += this.primaryKeys() || '';
25
+ columnsSql += this._addChecks();
26
+ columnsSql += ')';
27
+
23
28
  let sql =
24
29
  createStatement +
25
30
  this.tableName() +
@@ -73,7 +78,7 @@ class TableCompiler_MySQL extends TableCompiler {
73
78
 
74
79
  this.pushQuery({
75
80
  sql:
76
- `show fields from ${table} where field = ` +
81
+ `show full fields from ${table} where field = ` +
77
82
  this.client.parameter(from, this.tableBuilder, this.bindingsHolder),
78
83
  output(resp) {
79
84
  const column = resp[0];
@@ -101,7 +106,10 @@ class TableCompiler_MySQL extends TableCompiler {
101
106
  if (column.Default !== void 0 && column.Default !== null) {
102
107
  sql += ` DEFAULT '${column.Default}'`;
103
108
  }
104
- // Add back the auto increment if the column had it, fix issue #2767
109
+ if (column.Collation !== void 0 && column.Collation !== null) {
110
+ sql += ` COLLATE '${column.Collation}'`;
111
+ }
112
+ // Add back the auto increment if the column it, fix issue #2767
105
113
  if (column.Extra == 'auto_increment') {
106
114
  sql += ` AUTO_INCREMENT`;
107
115
  }
@@ -132,6 +140,34 @@ class TableCompiler_MySQL extends TableCompiler {
132
140
  });
133
141
  }
134
142
 
143
+ primaryKeys() {
144
+ const pks = (this.grouped.alterTable || []).filter(
145
+ (k) => k.method === 'primary'
146
+ );
147
+ if (pks.length > 0 && pks[0].args.length > 0) {
148
+ const columns = pks[0].args[0];
149
+ let constraintName = pks[0].args[1] || '';
150
+ if (constraintName) {
151
+ constraintName = ' constraint ' + this.formatter.wrap(constraintName);
152
+ }
153
+
154
+ if (this.grouped.columns) {
155
+ const incrementsCols = this._getIncrementsColumnNames();
156
+ if (incrementsCols.length) {
157
+ incrementsCols.forEach((c) => {
158
+ if (!columns.includes(c)) {
159
+ columns.unshift(c);
160
+ }
161
+ });
162
+ }
163
+ }
164
+
165
+ return `,${constraintName} primary key (${this.formatter.columnize(
166
+ columns
167
+ )})`;
168
+ }
169
+ }
170
+
135
171
  getFKRefs(runner) {
136
172
  const bindingsHolder = {
137
173
  bindings: [],
@@ -266,11 +302,13 @@ class TableCompiler_MySQL extends TableCompiler {
266
302
  });
267
303
  }
268
304
  }
269
- this.pushQuery(
270
- `alter table ${this.tableName()} add primary key ${constraintName}(${this.formatter.columnize(
271
- primaryCols
272
- )})`
273
- );
305
+ if (this.method !== 'create' && this.method !== 'createIfNot') {
306
+ this.pushQuery(
307
+ `alter table ${this.tableName()} add primary key ${constraintName}(${this.formatter.columnize(
308
+ primaryCols
309
+ )})`
310
+ );
311
+ }
274
312
  if (incrementsCols.length) {
275
313
  this.pushQuery(
276
314
  `alter table ${this.tableName()} modify column ${this.formatter.columnize(
@@ -8,9 +8,7 @@ const BlobHelper = require('../utils').BlobHelper;
8
8
  const { isString } = require('../../../util/is');
9
9
  const {
10
10
  columnize: columnize_,
11
- direction: direction_,
12
11
  } = require('../../../formatter/wrappingFormatter');
13
- const Raw = require('../../../raw');
14
12
 
15
13
  class Oracledb_Compiler extends Oracle_Compiler {
16
14
  // Compiles an "insert" query, allowing for multiple
@@ -158,8 +156,8 @@ class Oracledb_Compiler extends Oracle_Compiler {
158
156
  // later position binding will only convert the ? params
159
157
  subSql = self.formatter.client.positionBindings(subSql);
160
158
  const parameterizedValuesWithoutDefaultAndBlob = parameterizedValues
161
- .replace('DEFAULT, ', '')
162
- .replace(', DEFAULT', '')
159
+ .replace(/DEFAULT, /g, '')
160
+ .replace(/, DEFAULT/g, '')
163
161
  .replace('EMPTY_BLOB(), ', '')
164
162
  .replace(', EMPTY_BLOB()', '');
165
163
  return (
@@ -318,20 +316,7 @@ class Oracledb_Compiler extends Oracle_Compiler {
318
316
  }
319
317
 
320
318
  _groupOrder(item, type) {
321
- const column = super._formatGroupsItemValue(item.value);
322
- const direction =
323
- type === 'order' && item.type !== 'orderByRaw'
324
- ? ` ${direction_(
325
- item.direction,
326
- this.builder,
327
- this.client,
328
- this.bindingsHolder
329
- )}`
330
- : '';
331
- if (item.nulls && !(item.value instanceof Raw)) {
332
- return `${column}${direction ? direction : ''} nulls ${item.nulls}`;
333
- }
334
- return column + direction;
319
+ return super._groupOrderNulls(item, type);
335
320
  }
336
321
 
337
322
  update() {
@@ -5,4 +5,34 @@ module.exports = class QueryBuilder_PostgreSQL extends QueryBuilder {
5
5
  this._single.using = tables;
6
6
  return this;
7
7
  }
8
+
9
+ withMaterialized(alias, statementOrColumnList, nothingOrStatement) {
10
+ this._validateWithArgs(
11
+ alias,
12
+ statementOrColumnList,
13
+ nothingOrStatement,
14
+ 'with'
15
+ );
16
+ return this.withWrapped(
17
+ alias,
18
+ statementOrColumnList,
19
+ nothingOrStatement,
20
+ true
21
+ );
22
+ }
23
+
24
+ withNotMaterialized(alias, statementOrColumnList, nothingOrStatement) {
25
+ this._validateWithArgs(
26
+ alias,
27
+ statementOrColumnList,
28
+ nothingOrStatement,
29
+ 'with'
30
+ );
31
+ return this.withWrapped(
32
+ alias,
33
+ statementOrColumnList,
34
+ nothingOrStatement,
35
+ false
36
+ );
37
+ }
8
38
  };
@@ -112,7 +112,7 @@ class QueryCompiler_PG extends QueryCompiler {
112
112
  );
113
113
  }
114
114
  if (joinWheres.length > 0) {
115
- wheres += (wheres ? ' and ' : '') + joinWheres.join(' ');
115
+ wheres += (wheres ? ' and ' : 'where ') + joinWheres.join(' and ');
116
116
  }
117
117
  }
118
118
  if (tableJoins.length > 0) {
@@ -145,13 +145,11 @@ class QueryCompiler_PG extends QueryCompiler {
145
145
  if (columns === true) {
146
146
  return ' on conflict do nothing';
147
147
  }
148
- return ` on conflict (${this.formatter.columnize(columns)}) do nothing`;
148
+ return ` on conflict ${this._onConflictClause(columns)} do nothing`;
149
149
  }
150
150
 
151
151
  _merge(updates, columns, insert) {
152
- let sql = ` on conflict (${this.formatter.columnize(
153
- columns
154
- )}) do update set `;
152
+ let sql = ` on conflict ${this._onConflictClause(columns)} do update set `;
155
153
  if (updates && Array.isArray(updates)) {
156
154
  sql += updates
157
155
  .map((column) =>
@@ -219,6 +217,10 @@ class QueryCompiler_PG extends QueryCompiler {
219
217
  return lockMode + (tables.length ? ' of ' + this._tableNames(tables) : '');
220
218
  }
221
219
 
220
+ _groupOrder(item, type) {
221
+ return super._groupOrderNulls(item, type);
222
+ }
223
+
222
224
  forUpdate() {
223
225
  return this._lockingClause('for update');
224
226
  }
@@ -339,9 +341,9 @@ class QueryCompiler_PG extends QueryCompiler {
339
341
 
340
342
  whereJsonPath(statement) {
341
343
  let castValue = '';
342
- if (parseInt(statement.value)) {
344
+ if (!isNaN(statement.value) && parseInt(statement.value)) {
343
345
  castValue = '::int';
344
- } else if (parseFloat(statement.value)) {
346
+ } else if (!isNaN(statement.value) && parseFloat(statement.value)) {
345
347
  castValue = '::float';
346
348
  } else {
347
349
  castValue = " #>> '{}'";
@@ -91,21 +91,28 @@ class TableCompiler_PG extends TableCompiler {
91
91
 
92
92
  // To alter enum columns they must be cast to text first
93
93
  const isEnum = col.type === 'enu';
94
-
95
94
  this.pushQuery({
96
95
  sql: `alter table ${quotedTableName} alter column ${colName} drop default`,
97
96
  bindings: [],
98
97
  });
99
- this.pushQuery({
100
- sql: `alter table ${quotedTableName} alter column ${colName} drop not null`,
101
- bindings: [],
102
- });
103
- this.pushQuery({
104
- sql: `alter table ${quotedTableName} alter column ${colName} type ${type} using (${colName}${
105
- isEnum ? '::text::' : '::'
106
- }${type})`,
107
- bindings: [],
108
- });
98
+
99
+ const alterNullable = col.columnBuilder.alterNullable;
100
+ if (alterNullable) {
101
+ this.pushQuery({
102
+ sql: `alter table ${quotedTableName} alter column ${colName} drop not null`,
103
+ bindings: [],
104
+ });
105
+ }
106
+
107
+ const alterType = col.columnBuilder.alterType;
108
+ if (alterType) {
109
+ this.pushQuery({
110
+ sql: `alter table ${quotedTableName} alter column ${colName} type ${type} using (${colName}${
111
+ isEnum ? '::text::' : '::'
112
+ }${type})`,
113
+ bindings: [],
114
+ });
115
+ }
109
116
 
110
117
  const defaultTo = col.modified['defaultTo'];
111
118
  if (defaultTo) {
@@ -116,12 +123,14 @@ class TableCompiler_PG extends TableCompiler {
116
123
  });
117
124
  }
118
125
 
119
- const nullable = col.modified['nullable'];
120
- if (nullable && nullable[0] === false) {
121
- this.pushQuery({
122
- sql: `alter table ${quotedTableName} alter column ${colName} set not null`,
123
- bindings: [],
124
- });
126
+ if (alterNullable) {
127
+ const nullable = col.modified['nullable'];
128
+ if (nullable && nullable[0] === false) {
129
+ this.pushQuery({
130
+ sql: `alter table ${quotedTableName} alter column ${colName} set not null`,
131
+ bindings: [],
132
+ });
133
+ }
125
134
  }
126
135
  }
127
136
 
@@ -15,6 +15,7 @@ const TableCompiler = require('./schema/sqlite-tablecompiler');
15
15
  const ViewCompiler = require('./schema/sqlite-viewcompiler');
16
16
  const SQLite3_DDL = require('./schema/ddl');
17
17
  const Formatter = require('../../formatter');
18
+ const QueryBuilder = require('./query/sqlite-querybuilder');
18
19
 
19
20
  class Client_SQLite3 extends Client {
20
21
  constructor(config) {
@@ -44,6 +45,10 @@ class Client_SQLite3 extends Client {
44
45
  return new SqliteQueryCompiler(this, builder, formatter);
45
46
  }
46
47
 
48
+ queryBuilder() {
49
+ return new QueryBuilder(this);
50
+ }
51
+
47
52
  viewCompiler(builder, formatter) {
48
53
  return new ViewCompiler(this, builder, formatter);
49
54
  }
@@ -0,0 +1,33 @@
1
+ const QueryBuilder = require('../../../query/querybuilder.js');
2
+
3
+ module.exports = class QueryBuilder_SQLite3 extends QueryBuilder {
4
+ withMaterialized(alias, statementOrColumnList, nothingOrStatement) {
5
+ this._validateWithArgs(
6
+ alias,
7
+ statementOrColumnList,
8
+ nothingOrStatement,
9
+ 'with'
10
+ );
11
+ return this.withWrapped(
12
+ alias,
13
+ statementOrColumnList,
14
+ nothingOrStatement,
15
+ true
16
+ );
17
+ }
18
+
19
+ withNotMaterialized(alias, statementOrColumnList, nothingOrStatement) {
20
+ this._validateWithArgs(
21
+ alias,
22
+ statementOrColumnList,
23
+ nothingOrStatement,
24
+ 'with'
25
+ );
26
+ return this.withWrapped(
27
+ alias,
28
+ statementOrColumnList,
29
+ nothingOrStatement,
30
+ false
31
+ );
32
+ }
33
+ };
@@ -153,13 +153,11 @@ class QueryCompiler_SQLite3 extends QueryCompiler {
153
153
  if (columns === true) {
154
154
  return ' on conflict do nothing';
155
155
  }
156
- return ` on conflict (${this.formatter.columnize(columns)}) do nothing`;
156
+ return ` on conflict ${this._onConflictClause(columns)} do nothing`;
157
157
  }
158
158
 
159
159
  _merge(updates, columns, insert) {
160
- let sql = ` on conflict (${this.formatter.columnize(
161
- columns
162
- )}) do update set `;
160
+ let sql = ` on conflict ${this._onConflictClause(columns)} do update set `;
163
161
  if (updates && Array.isArray(updates)) {
164
162
  sql += updates
165
163
  .map((column) =>
@@ -14,25 +14,40 @@ class FunctionHelper {
14
14
  return this.client.raw('CURRENT_TIMESTAMP');
15
15
  }
16
16
 
17
- uuidToBin(uuid) {
17
+ uuidToBin(uuid, ordered = true) {
18
18
  const buf = Buffer.from(uuid.replace(/-/g, ''), 'hex');
19
- return Buffer.concat([
20
- buf.slice(6, 8),
21
- buf.slice(4, 6),
22
- buf.slice(0, 4),
23
- buf.slice(8, 16),
24
- ]);
19
+ return ordered
20
+ ? Buffer.concat([
21
+ buf.slice(6, 8),
22
+ buf.slice(4, 6),
23
+ buf.slice(0, 4),
24
+ buf.slice(8, 16),
25
+ ])
26
+ : Buffer.concat([
27
+ buf.slice(0, 4),
28
+ buf.slice(4, 6),
29
+ buf.slice(6, 8),
30
+ buf.slice(8, 16),
31
+ ]);
25
32
  }
26
33
 
27
- binToUuid(bin) {
28
- const buf = new Buffer(bin, 'hex');
29
- return [
30
- buf.toString('hex', 4, 8),
31
- buf.toString('hex', 2, 4),
32
- buf.toString('hex', 0, 2),
33
- buf.toString('hex', 8, 10),
34
- buf.toString('hex', 10, 16),
35
- ].join('-');
34
+ binToUuid(bin, ordered = true) {
35
+ const buf = Buffer.from(bin, 'hex');
36
+ return ordered
37
+ ? [
38
+ buf.toString('hex', 4, 8),
39
+ buf.toString('hex', 2, 4),
40
+ buf.toString('hex', 0, 2),
41
+ buf.toString('hex', 8, 10),
42
+ buf.toString('hex', 10, 16),
43
+ ].join('-')
44
+ : [
45
+ buf.toString('hex', 0, 4),
46
+ buf.toString('hex', 4, 6),
47
+ buf.toString('hex', 6, 8),
48
+ buf.toString('hex', 8, 10),
49
+ buf.toString('hex', 10, 16),
50
+ ].join('-');
36
51
  }
37
52
  }
38
53
 
@@ -562,8 +562,9 @@ function validateMigrationList(migrationSource, migrations) {
562
562
  const [all, completed] = migrations;
563
563
  const diff = getMissingMigrations(migrationSource, completed, all);
564
564
  if (!isEmpty(diff)) {
565
+ const names = diff.map((d) => d.name);
565
566
  throw new Error(
566
- `The migration directory is corrupt, the following files are missing: ${diff.join(
567
+ `The migration directory is corrupt, the following files are missing: ${names.join(
567
568
  ', '
568
569
  )}`
569
570
  );
@@ -2,15 +2,12 @@
2
2
  * @param { import("knex").Knex } knex
3
3
  * @returns { Promise<void> }
4
4
  */
5
- exports.seed = function(knex) {
5
+ exports.seed = async function(knex) {
6
6
  // Deletes ALL existing entries
7
- return knex('table_name').del()
8
- .then(function () {
9
- // Inserts seed entries
10
- return knex('table_name').insert([
11
- {id: 1, colName: 'rowValue1'},
12
- {id: 2, colName: 'rowValue2'},
13
- {id: 3, colName: 'rowValue3'}
14
- ]);
15
- });
7
+ await knex('table_name').del()
8
+ await knex('table_name').insert([
9
+ {id: 1, colName: 'rowValue1'},
10
+ {id: 2, colName: 'rowValue2'},
11
+ {id: 3, colName: 'rowValue3'}
12
+ ]);
16
13
  };
@@ -3,6 +3,8 @@
3
3
  module.exports = [
4
4
  'with',
5
5
  'withRecursive',
6
+ 'withMaterialized',
7
+ 'withNotMaterialized',
6
8
  'select',
7
9
  'as',
8
10
  'columns',
@@ -25,12 +27,16 @@ module.exports = [
25
27
  'fullOuterJoin',
26
28
  'crossJoin',
27
29
  'where',
28
- 'whereLike',
29
- 'whereILike',
30
30
  'andWhere',
31
31
  'orWhere',
32
32
  'whereNot',
33
33
  'orWhereNot',
34
+ 'whereLike',
35
+ 'andWhereLike',
36
+ 'orWhereLike',
37
+ 'whereILike',
38
+ 'andWhereILike',
39
+ 'orWhereILike',
34
40
  'whereRaw',
35
41
  'whereWrapped',
36
42
  'havingWrapped',