May 25, 2022

Prisma Support for CockroachDB Is Production Ready πŸͺ³

On May 10th, we were thrilled to release version 3.14.0 of Prisma ORM, which brought CockroachDB support to GA! This production-ready feature allows developers to make use of a scalable and resilient database.

Prisma Support for CockroachDB Is Production Ready

CockroachDB support in Prisma is now Generally Available πŸ’™

Back in February, as part of the 3.9.0 release of Prisma, preview support for CockroachDB was added. Today, as CockroachDB announces their 22.1 release, we are excited to officially announce the general availability of Prisma's CockroachDB connector.

Thanks to the amazing community feedback and testing, along with collaboration from the amazing Cockroach Labs team, this feature is now production-ready!

The power of serverless with a familiar interface

CockroachDB is a cloud-native distributed SQL database that allows developers to dynamically scale their database while maintaining data correctness.

Using Prisma with CockroachDB is, for the most part, the same as using Prisma with any other relational database such as PostgreSQL. When using these two together developers still have access to Prisma's features such as:

The magic behind Prisma with CockroachDB is that developers now have access to the scalable infrastructure of a distributed SQL database without having to be an expert in hosting and scaling databases. CockroachDB handles that piece of things so developers can focus on building their product rather than spending time on operational overhead.

The developer's experience when interacting with their CockroachDB database (or database cluster) is made super smooth as Prisma helps maintain advanced developer confidence and productivity via its type-safe client and migration tools while CockroachDB handles the complicated operational tasks such as:

  • Distributing and storing data within geographic regions
  • Allowing deployment across multiple cloud providers
  • Maintaining foreign key relations

Top-notch schema management

Starting and building upon a database using Prisma and CockroachDB together gives the developer a smooth experience as their database grows and changes πŸš€

CockroachDB by default uses what they call online schema changes, which handles applying database schema changes across a database cluster iteratively with zero downtime.

This feature, paired with Prisma Migrate, gives developers a very smooth workflow for managing your schema without the development team having to worry about how those changes are propagated.

A developer can make a change to their Prisma schema.

Then create a new migration to account for that change.

Finally, ideally during a CI/CD step, the changes can be deployed to the database and CockroachDB will apply these across all of the databases in the cluster without downtime.

Effectively optimize your queries

On top of the performance and scaling benefits of a distributed serverless database, Prisma allows developers to fine-tune their database to fit the querying needs of their applications.

Prisma Schema Language (PSL) supports configuring indexes to ensure maximum query performance.

This, along with CockroachDB's statement monitoring page provide a super useful set of tools that empower developers to have clear insights into their queries' performance and pathways to optimizing them.

Get started with CockroachDB and Prisma

To jump in and begin building with CockroachDB and Prisma, you can use Prisma Migrate in a new project or introspection in an existing project (see buttons below).

Start from scratch ...

To get started with CockroachDB and Prisma, you can follow our guide to set up a new project from scratch.


Start from scratch with CockroachDB

... or use Prisma with your existing CockroachDB database

If you already have an existing project that uses a CockroachDB database, you can easily start to incrementally adopt Prisma using introspection.

Prisma's introspection features reads the schema of your database and automatically builds the Prisma schema with those models.


Add Prisma to existing CockroachDB project

Don’t miss the next post!

Sign up for the Prisma Newsletter