From 919c55ce6f5a5fcab58579783f0854b922d1e61f Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 29 Sep 2026 12:09:46 -0400 Subject: [PATCH 1/7] Fix ENUM creation with newer versions of Sequelize v6 Newer versions of Sequelize v6 create ENUM types inside a `DO ... EXCEPTION WHEN duplicate_object` block, so that creating a type that already exists is not an error. CockroachDB does not support CREATE TYPE inside a function body, so any model with an ENUM column failed to sync with: unimplemented: CREATE TYPE usage inside a function definition is not supported This overrides the query generator's pgEnum to use CREATE TYPE IF NOT EXISTS instead, which has the same effect. This was originally proposed in cockroachdb/sequelize-cockroachdb#159. Co-Authored-By: Claude Opus 5.5 --- source/index.js | 29 +++++++++++++++++++++++++++++ tests/enum_test.js | 14 ++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/source/index.js b/source/index.js index 1ef71ad..965abd9 100644 --- a/source/index.js +++ b/source/index.js @@ -303,6 +303,35 @@ DataTypes.postgres.GEOGRAPHY.prototype.bindParam = (value, options) => { return `ST_GeomFromGeoJSON(${options.bindParam(value)}::json)::geography`; } +// [8] ENUM creation +// Newer versions of Sequelize v6 create ENUM types inside a +// `DO ... EXCEPTION WHEN duplicate_object` block to ignore types that already +// exist. CockroachDB does not support CREATE TYPE inside a function body, so +// use CREATE TYPE IF NOT EXISTS instead. +QueryGenerator.prototype.pgEnum = function ( + tableName, + attr, + dataType, + options +) { + const enumName = this.pgEnumName(tableName, attr, options); + let values; + + if (dataType.values) { + values = `ENUM(${dataType.values + .map(value => this.escape(value)) + .join(', ')})`; + } else { + values = dataType.toString().match(/^ENUM\(.+\)/)[0]; + } + + let sql = `CREATE TYPE IF NOT EXISTS ${enumName} AS ${values};`; + if (!!options && options.force === true) { + sql = this.pgEnumDrop(tableName, attr) + sql; + } + return sql; +}; + //// Done! Sequelize.supportsCockroachDB = true; diff --git a/tests/enum_test.js b/tests/enum_test.js index f5fce64..e0d8024 100644 --- a/tests/enum_test.js +++ b/tests/enum_test.js @@ -35,4 +35,18 @@ describe('Enum', function () { '"C" is not a valid choice in ["A","B"]' ); }); + + it('does not fail if the enum type already exists', async function () { + const queryInterface = this.sequelize.getQueryInterface(); + // Sequelize v5 calls this QueryGenerator. + const queryGenerator = + queryInterface.queryGenerator || queryInterface.QueryGenerator; + const createEnum = queryGenerator.pgEnum( + 'bars', + 'enum', + DataTypes.ENUM('A', 'B') + ); + expect(createEnum).to.include('CREATE TYPE IF NOT EXISTS'); + await this.sequelize.query(createEnum); + }); }); From 59a122d88476e7e59e8dbbecfb1ca9fbad753d69 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 29 Sep 2026 12:10:02 -0400 Subject: [PATCH 2/7] ci: update CockroachDB versions under test The previously tested versions (v21.1 and v21.2) are long out of support, and their images are no longer available on Docker Hub. Test against the regular (non-innovation) releases that are still supported: v24.3, v25.2, v25.4, and v26.2. The Sequelize integration tests now run against v26.2. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51433ff..9bab606 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,12 @@ jobs: # TODO(richardjcai): Re-enable tests for v5 after we get v6 suite passing. # Focus on getting tests passing for v6 test suite. sequelize-version: [5, 6] - cockroachdb-docker-version: ["cockroachdb/cockroach:v21.2.4", "cockroachdb/cockroach:v21.1.13"] + # Test the regular (non-innovation) releases that are still supported. + cockroachdb-docker-version: + - "cockroachdb/cockroach:latest-v24.3" + - "cockroachdb/cockroach:latest-v25.2" + - "cockroachdb/cockroach:latest-v25.4" + - "cockroachdb/cockroach:latest-v26.2" fail-fast: false runs-on: ubuntu-latest steps: @@ -81,10 +86,10 @@ jobs: SEQ_PW: '' SEQ_DB: sequelize_test steps: - - name: Start a single CockroachDB instance (v21.2.4) with docker + - name: Start a single CockroachDB instance (latest-v26.2) with docker run: | - docker pull cockroachdb/cockroach:v21.2.4 - docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 cockroachdb/cockroach:v21.2.4 start-single-node --insecure + docker pull cockroachdb/cockroach:latest-v26.2 + docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 cockroachdb/cockroach:latest-v26.2 start-single-node --insecure sudo apt update && sudo apt install wait-for-it -y wait-for-it -h localhost -p 26257 docker exec roach bash -c 'echo "CREATE DATABASE sequelize_test;" | cockroach sql --insecure' From e1f8beb359e7ca517b9f4c231534a7a6213644b9 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 29 Sep 2026 12:29:04 -0400 Subject: [PATCH 3/7] ci: run tests with Node.js 22 The `pg` dependency now resolves to a version that requires Node.js 16 or later, so the main test job failed on Node.js 12 with a SyntaxError while loading `pg`. Run CI with Node.js 22, and update the checkout and setup-node actions to v4. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bab606..ac76c83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,12 +45,12 @@ jobs: docker exec roach bash -c "echo 'CREATE DATABASE sequelize_test;' | $CONTAINER_ENTRYPOINT sql --insecure" - name: Checkout the repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Setup Node.js 12.x - uses: actions/setup-node@v1 + - name: Setup Node.js 22.x + uses: actions/setup-node@v4 with: - node-version: 12.x + node-version: 22.x - name: Install dependencies run: npm install @@ -95,12 +95,12 @@ jobs: docker exec roach bash -c 'echo "CREATE DATABASE sequelize_test;" | cockroach sql --insecure' - name: Checkout `sequelize-cockroachdb` repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Setup Node.js 12.x - uses: actions/setup-node@v1 + - name: Setup Node.js 22.x + uses: actions/setup-node@v4 with: - node-version: 12.x + node-version: 22.x - name: Install `sequelize-cockroachdb` dependencies run: npm install From cd32a38fa2aae36c790545d9813226250bfec329 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 29 Sep 2026 23:18:23 -0400 Subject: [PATCH 4/7] ci: stop testing with Sequelize v5 Sequelize v5 is no longer maintained. Remove it from the CI matrices of both the main tests and the Sequelize integration tests, along with the list of integration tests that were ignored only for v5. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 21 ++++--------------- .github/workflows/ignore_tests/v5/create.txt | 1 - .../ignore_tests/v5/transactions.txt | 3 --- .github/workflows/ignore_tests/v5/upsert.txt | 15 ------------- tests/run_tests/getTestsToIgnore.js | 13 ------------ 5 files changed, 4 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/ignore_tests/v5/create.txt delete mode 100644 .github/workflows/ignore_tests/v5/transactions.txt delete mode 100644 .github/workflows/ignore_tests/v5/upsert.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac76c83..992825d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,12 +18,9 @@ on: [push, pull_request] jobs: test: # Execute our own tests - name: Main - CRDB ${{ matrix.cockroachdb-docker-version }}, Sequelize v${{ matrix.sequelize-version }} + name: Main - CRDB ${{ matrix.cockroachdb-docker-version }} strategy: matrix: - # TODO(richardjcai): Re-enable tests for v5 after we get v6 suite passing. - # Focus on getting tests passing for v6 test suite. - sequelize-version: [5, 6] # Test the regular (non-innovation) releases that are still supported. cockroachdb-docker-version: - "cockroachdb/cockroach:latest-v24.3" @@ -55,28 +52,18 @@ jobs: - name: Install dependencies run: npm install - - name: Install Sequelize v${{ matrix.sequelize-version }} - run: npm install --save sequelize@^${{ matrix.sequelize-version }} - - name: Run tests run: npm test --crdb_version=${{ matrix.cockroachdb-docker-version }} sequelize-postgres-integration-tests: # Execute Sequelize integration tests for postgres - # This one will spawn 219 jobs + # This one will spawn 110 jobs if: ${{ !endsWith(github.event.head_commit.message, '[[skip sequelize integration tests]]') }} name: (${{ matrix.sequelize-branch }}) ${{ matrix.test-path }} strategy: matrix: - # TODO(richardjcai): Re-enable tests for v5 after we get v6 suite passing. - # Focus on getting tests passing for v6 test suite. - sequelize-branch: [v5, v6] - test-path: [associations/alias, associations/belongs-to-many, associations/belongs-to, associations/has-many, associations/has-one, associations/multiple-level-filters, associations/scope, associations/self, cls, configuration, data-types, dialects/abstract/connection-manager, dialects/postgres/associations, dialects/postgres/connection-manager, dialects/postgres/dao, dialects/postgres/data-types, dialects/postgres/error, dialects/postgres/hstore, dialects/postgres/query-interface, dialects/postgres/query, dialects/postgres/range, dialects/postgres/regressions, error, hooks/associations, hooks/bulkOperation, hooks/count, hooks/create, hooks/destroy, hooks/find, hooks/hooks, hooks/restore, hooks/updateAttributes, hooks/upsert, hooks/validate, include/findAll, include/findAndCountAll, include/findOne, include/limit, include/paranoid, include/schema, include/separate, include, instance/decrement, instance/destroy, instance/increment, instance/reload, instance/save, instance/to-json, instance/update, instance/values, instance, instance.validations, json, model/attributes/field, model/attributes/types, model/attributes, model/bulk-create/include, model/bulk-create, model/count, model/create/include, model/create, model/findAll/group, model/findAll/groupedLimit, model/findAll/order, model/findAll/separate, model/findAll, model/findOne, model/findOrBuild, model/geography, model/geometry, model/increment, model/json, model/optimistic_locking, model/paranoid, model/schema, model/scope/aggregate, model/scope/associations, model/scope/count, model/scope/destroy, model/scope/find, model/scope/findAndCountAll, model/scope/merge, model/scope/update, model/scope, model/searchPath, model/sum, model/sync, model/update, model/upsert, model, operators, pool, query-interface/changeColumn, query-interface/createTable, query-interface/describeTable, query-interface/dropEnum, query-interface/removeColumn, query-interface, replication, schema, sequelize/deferrable, sequelize/log, sequelize, sequelize.transaction, timezone, transaction, trigger, utils, vectors] - include: - - - # Luckily the test files are the same in v5 and v6, except for one extra file in v6: - sequelize-branch: v6 - test-path: sequelize/query + sequelize-branch: [v6] + test-path: [associations/alias, associations/belongs-to-many, associations/belongs-to, associations/has-many, associations/has-one, associations/multiple-level-filters, associations/scope, associations/self, cls, configuration, data-types, dialects/abstract/connection-manager, dialects/postgres/associations, dialects/postgres/connection-manager, dialects/postgres/dao, dialects/postgres/data-types, dialects/postgres/error, dialects/postgres/hstore, dialects/postgres/query-interface, dialects/postgres/query, dialects/postgres/range, dialects/postgres/regressions, error, hooks/associations, hooks/bulkOperation, hooks/count, hooks/create, hooks/destroy, hooks/find, hooks/hooks, hooks/restore, hooks/updateAttributes, hooks/upsert, hooks/validate, include/findAll, include/findAndCountAll, include/findOne, include/limit, include/paranoid, include/schema, include/separate, include, instance/decrement, instance/destroy, instance/increment, instance/reload, instance/save, instance/to-json, instance/update, instance/values, instance, instance.validations, json, model/attributes/field, model/attributes/types, model/attributes, model/bulk-create/include, model/bulk-create, model/count, model/create/include, model/create, model/findAll/group, model/findAll/groupedLimit, model/findAll/order, model/findAll/separate, model/findAll, model/findOne, model/findOrBuild, model/geography, model/geometry, model/increment, model/json, model/optimistic_locking, model/paranoid, model/schema, model/scope/aggregate, model/scope/associations, model/scope/count, model/scope/destroy, model/scope/find, model/scope/findAndCountAll, model/scope/merge, model/scope/update, model/scope, model/searchPath, model/sum, model/sync, model/update, model/upsert, model, operators, pool, query-interface/changeColumn, query-interface/createTable, query-interface/describeTable, query-interface/dropEnum, query-interface/removeColumn, query-interface, replication, schema, sequelize/deferrable, sequelize/log, sequelize, sequelize.transaction, sequelize/query, timezone, transaction, trigger, utils, vectors] fail-fast: false runs-on: ubuntu-latest env: diff --git a/.github/workflows/ignore_tests/v5/create.txt b/.github/workflows/ignore_tests/v5/create.txt deleted file mode 100644 index 8742246..0000000 --- a/.github/workflows/ignore_tests/v5/create.txt +++ /dev/null @@ -1 +0,0 @@ -should release transaction when meeting errors diff --git a/.github/workflows/ignore_tests/v5/transactions.txt b/.github/workflows/ignore_tests/v5/transactions.txt deleted file mode 100644 index f4b4501..0000000 --- a/.github/workflows/ignore_tests/v5/transactions.txt +++ /dev/null @@ -1,3 +0,0 @@ -do not rollback if already committed -supports for share -"after each" hook for "supports for share" diff --git a/.github/workflows/ignore_tests/v5/upsert.txt b/.github/workflows/ignore_tests/v5/upsert.txt deleted file mode 100644 index 6ba690a..0000000 --- a/.github/workflows/ignore_tests/v5/upsert.txt +++ /dev/null @@ -1,15 +0,0 @@ -works with upsert on id -works with upsert on a composite key -works with upsert on a composite primary key -works with BLOBs -works with .field -works with primary key using .field -works with database functions -does not update when setting current values -works when two separate uniqueKeys are passed -works when indexes are created via indexes array -works when composite indexes are created via indexes array -should return default value set by the database (upsert) -works with upsert on id -works for table with custom primary key field -works for non incrementing primaryKey diff --git a/tests/run_tests/getTestsToIgnore.js b/tests/run_tests/getTestsToIgnore.js index 25b727e..b2a0fa4 100644 --- a/tests/run_tests/getTestsToIgnore.js +++ b/tests/run_tests/getTestsToIgnore.js @@ -1,8 +1,6 @@ const fs = require('fs'), path = require('path'), readline = require('readline'); -const version_helper = require ('../../source/version_helper.js') -const semver = require('semver'); const sharedIgnoredTestsPath = './../.github/workflows/ignore_tests/shared'; @@ -28,17 +26,6 @@ function getTestNames() { return path.join(sharedIgnoredTestsPath, f); }); - const sequelizeVersion = version_helper.GetSequelizeVersion() - if (semver.satisfies(sequelizeVersion, '<=5')) { - const v5IgnoredTestsPath = './../.github/workflows/ignore_tests/v5'; - var v5files = fs.readdirSync(v5IgnoredTestsPath) - files = files.concat( - v5files.map(f => { - return path.join(v5IgnoredTestsPath, f); - }) - ); - } - return Promise.all(parseFilesForTests(files)).then(arr => arr.flat().join('|')) } From c4942426f2045034fc5dc95e03924b910fae55c9 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 29 Sep 2026 23:18:23 -0400 Subject: [PATCH 5/7] Stop overriding lockOuterJoinFailure This flag tells Sequelize's tests whether the database rejects FOR UPDATE on the nullable side of an outer join. CockroachDB used to allow this, but now rejects it with the same error as PostgreSQL: FOR UPDATE cannot be applied to the nullable side of an outer join Sequelize itself does not read this flag, so removing the override only affects which behavior the Sequelize integration tests expect. Co-Authored-By: Claude Opus 5.5 --- source/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/index.js b/source/index.js index 965abd9..553b743 100644 --- a/source/index.js +++ b/source/index.js @@ -56,8 +56,6 @@ const PostgresDialect = require('sequelize/lib/dialects/postgres/index'); PostgresDialect.prototype.supports.EXCEPTION = false; //// [2.1] Disable lock features support -// lockOuterJoinFailure is not supported. -PostgresDialect.prototype.supports.lockOuterJoinFailure = false; // skipLocked is not supported. PostgresDialect.prototype.supports.skipLocked = false; // lockKey is not supported. From caf6173ba6930cbfa87f49966cac4c18c0b93bad Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 29 Sep 2026 23:18:34 -0400 Subject: [PATCH 6/7] ci: fix Sequelize integration tests never running The Sequelize integration test jobs have not actually run any tests for a long time, but still reported success: - runTests.js passed the Promise returned by getTestsToIgnore() to Mocha as the grep filter, without awaiting it. Mocha then failed with "self._grep.test is not a function". - The Sequelize v6 source that CI downloads must be built before it can be loaded, but CI installed its dependencies with --ignore-scripts and never built it, so loading Sequelize failed. In both cases the error was an unhandled promise rejection, which Node.js 12 only logged as a warning before exiting with status 0. Await the ignore list, exit with a non-zero status if setting up the tests fails, and build Sequelize after installing its dependencies. Now that the tests run again, ignore the ones that fail on CockroachDB: - Tests that expect SERIAL ids to start at 1, that expect PostgreSQL's statement timeout error message, or that use deferrable constraints. - The bulkCreate conflictWhere upsert tests, which expect RETURNING to return rows in the same order as the inserted values. - A rollback test that does not wait for the rollback to finish, which races with the check for queries still running after each test. - Two logging tests that fail because telemetry queries are logged through the user's logger (cockroachdb/sequelize-cockroachdb#155). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 6 ++++-- .../ignore_tests/shared/dialects_query.txt | 1 + .../ignore_tests/shared/has_many.txt | 1 + .../ignore_tests/shared/model_bulk_create.txt | 1 + .../workflows/ignore_tests/shared/sync.txt | 1 + .../ignore_tests/shared/telemetry.txt | 2 ++ .../ignore_tests/shared/transactions.txt | 1 + .gitignore | 1 + tests/run_tests/runTests.js | 19 ++++++++++++------- 9 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ignore_tests/shared/telemetry.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 992825d..f89835f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,9 +99,11 @@ jobs: mv temp-unzip-out/* .downloaded-sequelize rmdir temp-unzip-out - - name: Install Sequelize dependencies + - name: Install Sequelize dependencies and build Sequelize working-directory: ./.downloaded-sequelize - run: npm install --ignore-scripts + run: | + npm install --ignore-scripts + node build.js - name: Provide the `sequelize-cockroachdb` patches # This script needs `fs-jetpack` as an extra dependency diff --git a/.github/workflows/ignore_tests/shared/dialects_query.txt b/.github/workflows/ignore_tests/shared/dialects_query.txt index f8f5acd..df68439 100644 --- a/.github/workflows/ignore_tests/shared/dialects_query.txt +++ b/.github/workflows/ignore_tests/shared/dialects_query.txt @@ -1 +1,2 @@ should throw due to alias being truncated +reuses connection after statement timeout diff --git a/.github/workflows/ignore_tests/shared/has_many.txt b/.github/workflows/ignore_tests/shared/has_many.txt index 3057c46..a6748e2 100644 --- a/.github/workflows/ignore_tests/shared/has_many.txt +++ b/.github/workflows/ignore_tests/shared/has_many.txt @@ -1,2 +1,3 @@ supports schemas should fetch associations for multiple instances with limit and order and a belongsTo relation +should ignore group from ancestor on deep separated query diff --git a/.github/workflows/ignore_tests/shared/model_bulk_create.txt b/.github/workflows/ignore_tests/shared/model_bulk_create.txt index 2e6e70f..33c700f 100644 --- a/.github/workflows/ignore_tests/shared/model_bulk_create.txt +++ b/.github/workflows/ignore_tests/shared/model_bulk_create.txt @@ -1,3 +1,4 @@ should make the auto incremented values available on the returned instances should make the auto incremented values available on the returned instances with custom fields should return auto increment primary key values +should upsert existing memberships diff --git a/.github/workflows/ignore_tests/shared/sync.txt b/.github/workflows/ignore_tests/shared/sync.txt index bf84c47..d79580c 100644 --- a/.github/workflows/ignore_tests/shared/sync.txt +++ b/.github/workflows/ignore_tests/shared/sync.txt @@ -1 +1,2 @@ should change a column if it exists in the model but is different in the database +updates the deferrable property of a foreign key diff --git a/.github/workflows/ignore_tests/shared/telemetry.txt b/.github/workflows/ignore_tests/shared/telemetry.txt new file mode 100644 index 0000000..8ad222e --- /dev/null +++ b/.github/workflows/ignore_tests/shared/telemetry.txt @@ -0,0 +1,2 @@ +custom logging with benchmarking has correct CLS context +executes a query with global benchmarking option and custom logger diff --git a/.github/workflows/ignore_tests/shared/transactions.txt b/.github/workflows/ignore_tests/shared/transactions.txt index f2a1701..d54f67a 100644 --- a/.github/workflows/ignore_tests/shared/transactions.txt +++ b/.github/workflows/ignore_tests/shared/transactions.txt @@ -2,3 +2,4 @@ supports transactions does not try to rollback a transaction that failed upon committing with SERIALIZABLE isolation level \(#3689\) should read the most recent committed rows when using the READ COMMITTED isolation level supports for share \(i.e. `SELECT ... LOCK IN SHARE MODE`\) +returns a promise that resolves once the transaction has been rolled back diff --git a/.gitignore b/.gitignore index 3c3629e..0c917a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +.downloaded-sequelize diff --git a/tests/run_tests/runTests.js b/tests/run_tests/runTests.js index af803cb..5dab593 100644 --- a/tests/run_tests/runTests.js +++ b/tests/run_tests/runTests.js @@ -5,10 +5,10 @@ const Mocha = require('mocha'), getTestsToIgnore = require('./getTestsToIgnore'); async function makeMocha() { - const testsToIgnore = getTestsToIgnore(); + const testsToIgnore = await getTestsToIgnore(); const mocha = new Mocha({ - grep: testsToIgnore, + grep: new RegExp(testsToIgnore), checkLeaks: true, reporter: 'spec', timeout: 30000, @@ -25,8 +25,13 @@ async function makeMocha() { } // Run the tests. -makeMocha().then(mocha => - mocha.run(function (failures) { - process.exit(failures ? 1 : 0); // exit with non-zero status if there were failures - }) -); +makeMocha() + .then(mocha => + mocha.run(function (failures) { + process.exit(failures ? 1 : 0); // exit with non-zero status if there were failures + }) + ) + .catch(err => { + console.error(err); + process.exit(1); + }); From fe133c09dc5bc9e3051b52842f66b1080c8898f6 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Wed, 30 Sep 2026 00:25:43 -0400 Subject: [PATCH 7/7] ci: run CockroachDB with an in-memory store Some Sequelize integration tests create many tables, and the test harness must drop them all within 10 seconds after each test. On CI runners this sometimes took longer, which failed the job. Start CockroachDB with an in-memory store, which made the include/findAll integration tests run about 4x faster locally (101s to 26s) and the main tests about 3x faster. Also disable automatic statistics collection, range merges, and diagnostics reporting, which are background work that the tests don't need. These settings did not measurably change the run time on their own. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f89835f..6ea5678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,10 +36,10 @@ jobs: run: | echo $CONTAINER_ENTRYPOINT docker pull ${{ matrix.cockroachdb-docker-version }} - docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 ${{ matrix.cockroachdb-docker-version }} start-single-node --insecure + docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 ${{ matrix.cockroachdb-docker-version }} start-single-node --insecure --store=type=mem,size=2GiB sudo apt update && sudo apt install wait-for-it -y wait-for-it -h localhost -p 26257 - docker exec roach bash -c "echo 'CREATE DATABASE sequelize_test;' | $CONTAINER_ENTRYPOINT sql --insecure" + docker exec roach $CONTAINER_ENTRYPOINT sql --insecure -e "SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false" -e "SET CLUSTER SETTING kv.range_merge.queue.enabled = false" -e "SET CLUSTER SETTING diagnostics.reporting.enabled = false" -e "CREATE DATABASE sequelize_test" - name: Checkout the repository uses: actions/checkout@v4 @@ -76,10 +76,10 @@ jobs: - name: Start a single CockroachDB instance (latest-v26.2) with docker run: | docker pull cockroachdb/cockroach:latest-v26.2 - docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 cockroachdb/cockroach:latest-v26.2 start-single-node --insecure + docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 cockroachdb/cockroach:latest-v26.2 start-single-node --insecure --store=type=mem,size=2GiB sudo apt update && sudo apt install wait-for-it -y wait-for-it -h localhost -p 26257 - docker exec roach bash -c 'echo "CREATE DATABASE sequelize_test;" | cockroach sql --insecure' + docker exec roach cockroach sql --insecure -e "SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false" -e "SET CLUSTER SETTING kv.range_merge.queue.enabled = false" -e "SET CLUSTER SETTING diagnostics.reporting.enabled = false" -e "CREATE DATABASE sequelize_test" - name: Checkout `sequelize-cockroachdb` repository uses: actions/checkout@v4