Skip to content

Faire/sqldelight-cockroachdb-dialect

Repository files navigation

Notice

There's a regression from the Postgres Dialect (ALTER TABLE ALTER COLUMN) in SQLDelight 2.0.1 that prevents this dialect from working during the migration process. Please use 0.2.0 for the time being.

SQLDelight CockroachDB Dialect

CockroachDB dialect for SQLDelight. CockroachDB supports the majority of the PostgreSQL syntax (please see this page for more details).

Disclaimer

This doesn't fully cover the whole SQL syntax of CockroachDB. It's a work in progress and contributions are welcome.

Differences between the PostgreSQL SQLDelight Dialect

Using this Library

Please see the official SQLDelight Documentation.

To use this dialect, set the dialect to be: dialect("com.faire:sqldelight-cockroachdb-dialect:<version>")

Latest version can be found here.

Using a Snapshot Release

A snapshot release is built and released on the maven snapshot repo. To use a snapshot release, follow these steps:

  1. Add the maven snapshot repo to your project
maven {
  url = uri("https://oss.sonatype.org/content/repositories/snapshots")
  mavenContent {
    snapshotsOnly()
  }
}
  1. Supply a SNAPSHOT version of the library. The automatic build and release process was introduced after 80dc790b417dedb12ae657b9112f0e6edfe4c5a1. The version structure for the releases is as follows <latestVersion>-<sha>-SNAPSHOT
  • The latestVersion is the latest release prior to the commit. For example if there is a release 1.0 and 1.1 and there are commits prior to 1.1 being released, the version for a snapshot release in between will be 1.0. You can find the version by looking in the gradle.properties file.

For example, for the commit sha of 80dc790b417dedb12ae657b9112f0e6edfe4c5a1, you can visit the state of the repo for that hash by visiting:

https://github.com/Faire/sqldelight-cockroachdb-dialect/tree/80dc790b417dedb12ae657b9112f0e6edfe4c5a1 (note the hash at the end).

Then access the gradle.properties file https://github.com/Faire/sqldelight-cockroachdb-dialect/blob/80dc790b417dedb12ae657b9112f0e6edfe4c5a1/gradle.properties which has 0.3.1 version.

Given these two values, you should use 0.3.1-80dc790b417dedb12ae657b9112f0e6edfe4c5a1-SNAPSHOT as the version in the previous section

Here is a sample PR that is using a snapshot release for the dialect.