Coder Social home page Coder Social logo

sequelize-cockroachdb's Introduction

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.

sequelize-cockroachdb's People

Contributors

dougmrqs avatar douglasselias avatar richardjcai avatar papb avatar rafiss avatar benesch avatar cuongdo avatar nvanbenschoten avatar domir avatar justinj avatar otan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.