Detalhes do pacote

sequelize-cockroachdb

cockroachdb13kApache-2.06.0.5

Support using Sequelize with CockroachDB.

database, sequelize, cockroach, cockroachdb

readme (leia-me)

sequelize-cockroachdb

This NPM package makes Sequelize compatible with CockroachDB.

Learn how to build a Node.js app with CockroachDB.

Please file bugs against the sequelize-cockroachdb project

Requirements

This package needs Node.js v12 or later

Setup and run tests

First make sure you have CockroachDB installed. You can run cockroach version to see if is installed or you can download here

Run cockroach start-single-node --insecure --logtostderr to start the database. If this returns ERROR: cockroach server exited with error: unable to lookup hostname run with --host localhost flag.

Run cockroach sql --insecure to enter in SQL mode and type CREATE DATABASE sequelize_test;

Then install the depedencies with npm i and npm test to run all tests

Limitations

Dealing with transactions

From the docs

CockroachDB guarantees that while a transaction is pending, it is isolated from other concurrent transactions with serializable isolation.

Which means that any other query made in another connection to the same node will hang.

For example:

const t = await this.sequelize.transaction();
await this.User.create({ name: "bob" }, { transaction: t });
await this.User.findAll({ transaction: null }); // Query will hang!

CockroachDB does not support yet:

See tests/model_create_test.js to browse those implementations.

changelog (log de mudanças)

Version 6.0.5

Released January 12, 2022

  • Fixed a bug with importing modules from Sequelize.
  • Updated CockroachDB versions under test (includes v21.2 now).

Version 6.0.4

Released December 16, 2021

  • Fixed a bug with checking the version on startup.

Version 6.0.3

Released October 21, 2021

  • Use a deterministic ordering when introspecting enum types.
  • Version number telemetry now only reports the major/minor versions of Sequelize.

Version 6.0.2

Released September 30, 2021

  • Fix a missing import that would cause an error when validating datatypes.

Version 6.0.1

Released July 14, 2021

  • Record telemetry for sequelize-cockroachdb version in addition to the sequelize version.

Version 6.0.0

Released June 14, 2021

  • Initial support for Sequelize 6.0
  • Added telemetry. The sequelize version is recorded when creating a new instance of a CockroachDB Sequelize instance.
  • Opt out of telemetry by specifying cockroachdbTelemetryDisabled : true in the dialectOptions object when creating a Sequelize object.
  • Example:
      var sequelize2 = new Sequelize({
          dialect: "postgres",
          username: "max",
          password: "",
          host: "localhost",
          port: 26257,
          database: "sequelize_test",
          dialectOptions: {cockroachdbTelemetryDisabled : true},
          logging: false,
      });