Repository: knex/knex
Pull request #4876 (2021-12-06 09:07:51)

Bump prettier from 2.4.1 to 2.5.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.1 to 2.5.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/releases">prettier's releases</a>.</em></p>
<blockquote>
<h2>2.5.1</h2>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#251">Changelog</a></p>
<h2>2.5.0</h2>
<p><a href="https://github.com/prettier/prettier/compare/2.4.1...2.5.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2021/11/25/2.5.0.html">Release note</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's changelog</a>.</em></p>
<blockquote>
<h1>2.5.1</h1>
<p><a href="https://github.com/prettier/prettier/compare/2.5.0...2.5.1">diff</a></p>
<h4>Improve formatting for empty tuple types (<a href="https://github-redirect.dependabot.com/prettier/prettier/pull/11884">#11884</a> by <a href="https://github.com/sosukesuzuki"><code>@​sosukesuzuki</code></a>)</h4>
<!-- raw HTML omitted -->
<pre lang="tsx"><code>// Input
type Foo =
  Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends []
    ? Foo3
    : Foo4;
<p>// Prettier 2.5.0
type Foo = Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends [</p>
<p>]
? Foo3
: Foo4;</p>
<p>// Prettier 2.5.0 (tailingCommma = all)
// Invalid TypeScript code
type Foo = Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends [
,
]
? Foo3
: Foo4;</p>
<p>// Prettier 2.5.1
type Foo =
Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends []
? Foo3
: Foo4;</p>
<p></code></pre></p>
<h4>Fix compatibility with Jest inline snapshot test (<a href="https://github-redirect.dependabot.com/prettier/prettier/pull/11892">#11892</a> by <a href="https://github.com/fisker"><code>@​fisker</code></a>)</h4>
<p>A internal change in Prettier@v2.5.0 accidentally breaks the Jest inline snapshot test.</p>
<h4>Support Glimmer's named blocks (<a href="https://github-redirect.dependabot.com/prettier/prettier/pull/11899">#11899</a> by <a href="https://github.com/duailibe"><code>@​duailibe</code></a>)</h4>
<p>Prettier already supported this feature, but it converted empty named blocks to self-closing, which is not supported by the Glimmer compiler.</p>
<p>See: <a href="https://emberjs.github.io/rfcs/0460-yieldable-named-blocks.html">Glimmer's named blocks</a>.</p>
<!-- raw HTML omitted -->
<pre lang="hbs"><code>// Input
&lt;/tr&gt;&lt;/table&gt; 
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/prettier/prettier/commit/56ed71d1c99bdf5253d03df1fa2d2bd0693d8214"><code>56ed71d</code></a> Release 2.5.1</li>
<li><a href="https://github.com/prettier/prettier/commit/29f408c99e4fcfc7b5c864ba9d2d55c3c07c0e57"><code>29f408c</code></a> Add changelog for <a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11892">#11892</a> (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11904">#11904</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/e7a74529a576009ea1c4b85eea67402aaee00980"><code>e7a7452</code></a> Make <code>options</code> argument in parsers optional (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11892">#11892</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/99649c7fd2342c7587db658090e52f262d91a76e"><code>99649c7</code></a> [handlebars] Named blocks can't be self closing (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11900">#11900</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/c0250b3837de815c18763149020d607868b2c485"><code>c0250b3</code></a> Improve formatting for empty tuple types (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11884">#11884</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/7fc196e96be43c0abf92fe28eb9e5c7ce3a87120"><code>7fc196e</code></a> Clean changelog_unreleased</li>
<li><a href="https://github.com/prettier/prettier/commit/04aa850fde8417778fa346145ac8245ff9e52e20"><code>04aa850</code></a> Add 2.5 blog (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11823">#11823</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/255d38982f62a971473f0f12202f95799127a47f"><code>255d389</code></a> Update dependents count</li>
<li><a href="https://github.com/prettier/prettier/commit/854ca328a2ca8d67ec2793c4e4a5ea01f10f7ea1"><code>854ca32</code></a> Git blame ignore 2.5.0</li>
<li><a href="https://github.com/prettier/prettier/commit/846dbdd7e8c9deb315b3e663b3103c559e798a89"><code>846dbdd</code></a> Bump Prettier dependency to 2.5.0</li>
<li>Additional commits viewable in <a href="https://github.com/prettier/prettier/compare/2.4.1...2.5.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=2.4.1&new-version=2.5.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9792c6b8..111b10be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,29 @@
 # Master (Unreleased)
 
+# 1.0.3 - 11 February, 2022
+
+### Bug fixes:
+
+- Fix error message for missing migration files #4937
+- Add withMaterialized and withNotMaterialized to method-constants #5009
+- PostgreSQL: Fix whereJsonPath queries #5011
+- PostgreSQL: Fix delete joins #5016
+- CockroachDB: Fix whereJsonPath queries #5011
+- MySQL: Create primary keys in same statement #5017
+
+### Typings:
+
+- Fix type definition for getMigration in MigrationSource #4998
+- Fix argument type of alter method #4996
+
+### Improvements:
+
+- Use async / await syntax in seeds as default #5005
+
+### Documentation:
+
+- Add Firebird dialect to ECOSYSTEM.md #5003
+
 # 1.0.2 - 02 February, 2022
 
 ### New features:
diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md
index a137b1bd..6dd72d14 100644
--- a/ECOSYSTEM.md
+++ b/ECOSYSTEM.md
@@ -2,6 +2,9 @@
 
 Plugins and tools maintained by the knex team are listed under [Core](#core) while plugins and tools maintained by the community are listed in the [Community](#community) section.
 
+#### [Dialects](#dialects)
+- [`knex-firebird-dialect`](https://github.com/Tomas2D/knex-firebird-dialect) Dialect for a Firebird database.
+
 #### [Core](#core)
 - [`casbin-knex-adapter`](https://github.com/knex/casbin-knex-adapter) Knex adapter for [Node-Casbin](https://github.com/casbin/node-casbin).
 - [`knex-schema-inspector`](https://github.com/knex/knex-schema-inspector) Utility for extracting information about the existing DB schema.
diff --git a/lib/dialects/cockroachdb/crdb-querycompiler.js b/lib/dialects/cockroachdb/crdb-querycompiler.js
index 5a1c2c4a..0a9cf105 100644
--- a/lib/dialects/cockroachdb/crdb-querycompiler.js
+++ b/lib/dialects/cockroachdb/crdb-querycompiler.js
@@ -35,9 +35,9 @@ class QueryCompiler_CRDB extends QueryCompiler_PG {
 
   whereJsonPath(statement) {
     let castValue = '';
-    if (parseInt(statement.value)) {
+    if (!isNaN(statement.value) && parseInt(statement.value)) {
       castValue = '::int';
-    } else if (parseFloat(statement.value)) {
+    } else if (!isNaN(statement.value) && parseFloat(statement.value)) {
       castValue = '::float';
     } else {
       castValue = " #>> '{}'";
diff --git a/lib/dialects/mysql/schema/mysql-tablecompiler.js b/lib/dialects/mysql/schema/mysql-tablecompiler.js
index 06c920cb..ac192ee4 100644
--- a/lib/dialects/mysql/schema/mysql-tablecompiler.js
+++ b/lib/dialects/mysql/schema/mysql-tablecompiler.js
@@ -19,7 +19,12 @@ class TableCompiler_MySQL extends TableCompiler {
       : 'create table ';
     const { client } = this;
     let conn = {};
-    const columnsSql = ' (' + columns.sql.join(', ') + this._addChecks() + ')';
+    let columnsSql = ' (' + columns.sql.join(', ');
+
+    columnsSql += this.primaryKeys() || '';
+    columnsSql += this._addChecks();
+    columnsSql += ')';
+
     let sql =
       createStatement +
       this.tableName() +
@@ -135,6 +140,34 @@ class TableCompiler_MySQL extends TableCompiler {
     });
   }
 
+  primaryKeys() {
+    const pks = (this.grouped.alterTable || []).filter(
+      (k) => k.method === 'primary'
+    );
+    if (pks.length > 0 && pks[0].args.length > 0) {
+      const columns = pks[0].args[0];
+      let constraintName = pks[0].args[1] || '';
+      if (constraintName) {
+        constraintName = ' constraint ' + this.formatter.wrap(constraintName);
+      }
+
+      if (this.grouped.columns) {
+        const incrementsCols = this._getIncrementsColumnNames();
+        if (incrementsCols.length) {
+          incrementsCols.forEach((c) => {
+            if (!columns.includes(c)) {
+              columns.unshift(c);
+            }
+          });
+        }
+      }
+
+      return `,${constraintName} primary key (${this.formatter.columnize(
+        columns
+      )})`;
+    }
+  }
+
   getFKRefs(runner) {
     const bindingsHolder = {
       bindings: [],
@@ -269,11 +302,13 @@ class TableCompiler_MySQL extends TableCompiler {
         });
       }
     }
-    this.pushQuery(
-      `alter table ${this.tableName()} add primary key ${constraintName}(${this.formatter.columnize(
-        primaryCols
-      )})`
-    );
+    if (this.method !== 'create' && this.method !== 'createIfNot') {
+      this.pushQuery(
+        `alter table ${this.tableName()} add primary key ${constraintName}(${this.formatter.columnize(
+          primaryCols
+        )})`
+      );
+    }
     if (incrementsCols.length) {
       this.pushQuery(
         `alter table ${this.tableName()} modify column ${this.formatter.columnize(
diff --git a/lib/dialects/postgres/query/pg-querycompiler.js b/lib/dialects/postgres/query/pg-querycompiler.js
index fb1d766d..e4dcff4e 100644
--- a/lib/dialects/postgres/query/pg-querycompiler.js
+++ b/lib/dialects/postgres/query/pg-querycompiler.js
@@ -112,7 +112,7 @@ class QueryCompiler_PG extends QueryCompiler {
           );
         }
         if (joinWheres.length > 0) {
-          wheres += (wheres ? ' and ' : '') + joinWheres.join(' ');
+          wheres += (wheres ? ' and ' : 'where ') + joinWheres.join(' and ');
         }
       }
       if (tableJoins.length > 0) {
@@ -341,9 +341,9 @@ class QueryCompiler_PG extends QueryCompiler {
 
   whereJsonPath(statement) {
     let castValue = '';
-    if (parseInt(statement.value)) {
+    if (!isNaN(statement.value) && parseInt(statement.value)) {
       castValue = '::int';
-    } else if (parseFloat(statement.value)) {
+    } else if (!isNaN(statement.value) && parseFloat(statement.value)) {
       castValue = '::float';
     } else {
       castValue = " #>> '{}'";
diff --git a/lib/migrations/seed/stub/js.stub b/lib/migrations/seed/stub/js.stub
index 980bca05..d0e65403 100644
--- a/lib/migrations/seed/stub/js.stub
+++ b/lib/migrations/seed/stub/js.stub
@@ -2,15 +2,12 @@
  * @param { import("knex").Knex } knex
  * @returns { Promise<void> } 
  */
-exports.seed = function(knex) {
+exports.seed = async function(knex) {
   // Deletes ALL existing entries
-  return knex('table_name').del()
-    .then(function () {
-      // Inserts seed entries
-      return knex('table_name').insert([
-        {id: 1, colName: 'rowValue1'},
-        {id: 2, colName: 'rowValue2'},
-        {id: 3, colName: 'rowValue3'}
-      ]);
-    });
+  await knex('table_name').del()
+  await knex('table_name').insert([
+    {id: 1, colName: 'rowValue1'},
+    {id: 2, colName: 'rowValue2'},
+    {id: 3, colName: 'rowValue3'}
+  ]);
 };
diff --git a/lib/query/method-constants.js b/lib/query/method-constants.js
index e8896e85..19a6ee08 100644
--- a/lib/query/method-constants.js
+++ b/lib/query/method-constants.js
@@ -3,6 +3,8 @@
 module.exports = [
   'with',
   'withRecursive',
+  'withMaterialized',
+  'withNotMaterialized',
   'select',
   'as',
   'columns',
diff --git a/lib/query/querybuilder.js b/lib/query/querybuilder.js
index cf7b5dfd..c373f6e6 100644
--- a/lib/query/querybuilder.js
+++ b/lib/query/querybuilder.js
@@ -1505,8 +1505,8 @@ class Builder extends EventEmitter {
     return this;
   }
 
-  orWhereJsonPath(column, operator, value) {
-    return this._bool('or').whereJsonPath(column, operator, value);
+  orWhereJsonPath(column, path, operator, value) {
+    return this._bool('or').whereJsonPath(column, path, operator, value);
   }
 
   // Json superset wheres
diff --git a/package.json b/package.json
index bac60694..751b0de9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "knex",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "description": "A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3",
   "main": "knex",
   "types": "types/index.d.ts",
@@ -123,7 +123,7 @@
     "oracledb": "^5.3.0",
     "pg": "^8.7.1",
     "pg-query-stream": "^4.2.1",
-    "prettier": "2.4.1",
+    "prettier": "2.5.1",
     "rimraf": "^3.0.2",
     "sinon": "^13.0.1",
     "sinon-chai": "^3.7.0",
diff --git a/types/index.d.ts b/types/index.d.ts
index 08d785ec..daccda0c 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -2210,7 +2210,7 @@ export declare namespace Knex {
     notNullable(): ColumnBuilder;
     nullable(): ColumnBuilder;
     comment(value: string): ColumnBuilder;
-    alter(options: Readonly<{alterNullable?: boolean, alterType?: boolean}>): ColumnBuilder;
+    alter(options?: Readonly<{alterNullable?: boolean, alterType?: boolean}>): ColumnBuilder;
     queryContext(context: any): ColumnBuilder;
     after(columnName: string): ColumnBuilder;
     first(): ColumnBuilder;
@@ -2662,7 +2662,7 @@ export declare namespace Knex {
   interface MigrationSource<TMigrationSpec> {
     getMigrations(loadExtensions: readonly string[]): Promise<TMigrationSpec[]>;
     getMigrationName(migration: TMigrationSpec): string;
-    getMigration(migration: TMigrationSpec): Migration;
+    getMigration(migration: TMigrationSpec): Promise<Migration>;
   }
 
   interface MigratorConfig {


Test patch:
diff --git a/test/integration2/query/select/where.spec.js b/test/integration2/query/select/where.spec.js
index f9da41af..96839edc 100644
--- a/test/integration2/query/select/where.spec.js
+++ b/test/integration2/query/select/where.spec.js
@@ -690,6 +690,30 @@ describe('Where', function () {
           });
         });
 
+        it('where and or where json path equal numeric', async () => {
+          const result = await knex('cities')
+            .select('name')
+            .whereJsonPath('statistics', '$.roads.min', '=', 1455)
+            .orWhereJsonPath('statistics', '$.roads.min', '=', 1655);
+          expect(result[0]).to.eql({
+            name: 'Milan',
+          });
+        });
+
+        it('where json path equal string starting with number', async () => {
+          const result = await knex('cities')
+            .select('name')
+            .whereJsonPath(
+              'statistics',
+              '$.statisticId',
+              '=',
+              '6qITEHRUNJ4bdAmA0lk82'
+            );
+          expect(result[0]).to.eql({
+            name: 'Paris',
+          });
+        });
+
         it('where multiple json path', async () => {
           const result = await knex('cities')
             .select('name')
diff --git a/test/integration2/schema/misc.spec.js b/test/integration2/schema/misc.spec.js
index b4797ea5..3f663eab 100644
--- a/test/integration2/schema/misc.spec.js
+++ b/test/integration2/schema/misc.spec.js
@@ -820,8 +820,7 @@ describe('Schema (misc)', () => {
             })
             .testSql((tester) => {
               tester('mysql', [
-                'create table `test_table_three` (`main` int not null, `paragraph` text, `metadata` json default (\'{"a":10}\')) default character set utf8 engine = InnoDB',
-                'alter table `test_table_three` add primary key `test_table_three_pkey`(`main`)',
+                'create table `test_table_three` (`main` int not null, `paragraph` text, `metadata` json default (\'{"a":10}\'), primary key (`main`)) default character set utf8 engine = InnoDB',
               ]);
               tester(
                 ['pg', 'cockroachdb'],
diff --git a/test/unit/query/builder.js b/test/unit/query/builder.js
index 47671030..14e3adc7 100644
--- a/test/unit/query/builder.js
+++ b/test/unit/query/builder.js
@@ -10446,6 +10446,73 @@ describe('QueryBuilder', () => {
       );
     });
 
+    it('should include joins without where clause when deleting #5015', () => {
+      testsql(
+        qb().del().from('users').join('photos', 'photos.id', 'users.id'),
+        {
+          mysql: {
+            sql: 'delete `users` from `users` inner join `photos` on `photos`.`id` = `users`.`id`',
+          },
+          mssql: {
+            sql: 'delete [users] from [users] inner join [photos] on [photos].[id] = [users].[id];select @@rowcount',
+          },
+          oracledb: {
+            sql: 'delete "users" from "users" inner join "photos" on "photos"."id" = "users"."id"',
+          },
+          pg: {
+            sql: 'delete from "users" using "photos" where "photos"."id" = "users"."id"',
+            bindings: [],
+          },
+          'pg-redshift': {
+            sql: 'delete "users" from "users" inner join "photos" on "photos"."id" = "users"."id"',
+          },
+          sqlite3: {
+            sql: 'delete `users` from `users` inner join `photos` on `photos`.`id` = `users`.`id`',
+          },
+        }
+      );
+    });
+
+    it('should include joins clauses with multiple joins with where clause when deleting #5015', () => {
+      testsql(
+        qb()
+          .where('activated', false)
+          .join('accounts', function (jb) {
+            jb.on('accounts.id', 'users.account_id').andOn(
+              'accounts.user_id',
+              'users.id'
+            );
+          })
+          .del(),
+        {
+          mysql: {
+            sql: 'delete  from  inner join `accounts` on `accounts`.`id` = `users`.`account_id` and `accounts`.`user_id` = `users`.`id` where `activated` = ?',
+            bindings: [false],
+          },
+          mssql: {
+            sql: 'delete  from  inner join [accounts] on [accounts].[id] = [users].[account_id] and [accounts].[user_id] = [users].[id] where [activated] = ?;select @@rowcount',
+            bindings: [false],
+          },
+          oracledb: {
+            sql: 'delete  from  inner join "accounts" on "accounts"."id" = "users"."account_id" and "accounts"."user_id" = "users"."id" where "activated" = ?',
+            bindings: [false],
+          },
+          pg: {
+            sql: 'delete from  using "accounts" where "activated" = ? and "accounts"."id" = "users"."account_id" and "accounts"."user_id" = "users"."id"',
+            bindings: [false],
+          },
+          'pg-redshift': {
+            sql: 'delete  from  inner join "accounts" on "accounts"."id" = "users"."account_id" and "accounts"."user_id" = "users"."id" where "activated" = ?',
+            bindings: [false],
+          },
+          sqlite3: {
+            sql: 'delete  from  inner join `accounts` on `accounts`.`id` = `users`.`account_id` and `accounts`.`user_id` = `users`.`id` where `activated` = ?',
+            bindings: [false],
+          },
+        }
+      );
+    });
+
     it('should include join when deleting with mssql triggers', () => {
       const triggerOptions = { includeTriggerModifications: true };
       testsql(
diff --git a/test/unit/schema-builder/mysql.js b/test/unit/schema-builder/mysql.js
index e16c486a..563a52a7 100644
--- a/test/unit/schema-builder/mysql.js
+++ b/test/unit/schema-builder/mysql.js
@@ -79,6 +79,39 @@ module.exports = function (dialect) {
       );
     });
 
+    it('test basic create table with composite key on incrementing column + other', function () {
+      tableSql = client
+        .schemaBuilder()
+        .createTable('users', function (table) {
+          table.primary(['userId', 'name']);
+          table.increments('userId');
+          table.string('name');
+        })
+        .toSQL();
+
+      equal(2, tableSql.length);
+      expect(tableSql[0].sql).to.equal(
+        'create table `users` (`userId` int unsigned not null, `name` varchar(255), primary key (`userId`, `name`))'
+      );
+      expect(tableSql[1].sql).to.equal(
+        'alter table `users` modify column `userId` int unsigned not null auto_increment'
+      );
+    });
+
+    it('test basic create table with inline primary key creation', function () {
+      tableSql = client
+        .schemaBuilder()
+        .createTable('users', function (table) {
+          table.string('id', 24).primary();
+        })
+        .toSQL();
+
+      equal(1, tableSql.length);
+      expect(tableSql[0].sql).to.equal(
+        'create table `users` (`id` varchar(24), primary key (`id`))'
+      );
+    });
+
     it('test basic create table with charset and collate', function () {
       tableSql = client.schemaBuilder().createTable('users', function (table) {
         table.increments('id');
@@ -1357,17 +1390,6 @@ module.exports = function (dialect) {
       expect(tableSql[0].sql).to.equal(
         'alter table `users` add primary key `testconstraintname`(`test1`, `test2`)'
       );
-
-      tableSql = client
-        .schemaBuilder()
-        .createTable('users', function (t) {
-          t.string('test').primary('testconstraintname');
-        })
-        .toSQL();
-
-      expect(tableSql[1].sql).to.equal(
-        'alter table `users` add primary key `testconstraintname`(`test`)'
-      );
     });
 
     describe('queryContext', function () {
diff --git a/test/util/dataInsertHelper.js b/test/util/dataInsertHelper.js
index 2394b58d..2141e1b7 100644
--- a/test/util/dataInsertHelper.js
+++ b/test/util/dataInsertHelper.js
@@ -143,6 +143,7 @@ async function insertCities(knex) {
         min: 1234,
         max: 1333,
       },
+      statisticId: '6qITEHRUNJ4bdAmA0lk82',
     },
     temperature: {
       desc: 'cold',
@@ -172,6 +173,7 @@ async function insertCities(knex) {
         max: 1655,
       },
       hotYears: [2012, 2015, 2021],
+      statisticId: '-4mZkPL-ZzRyEed00RQTQ',
     },
     temperature: {
       desc: 'warm',
@@ -201,6 +203,7 @@ async function insertCities(knex) {
         max: 156,
       },
       hotYears: [2016],
+      statisticId: '6bBGzpyL3sTRrxWs5gXTa',
     },
     temperature: {
       desc: 'verycold',