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.
CockroachDB dialect for SQLDelight. CockroachDB supports the majority of the PostgreSQL syntax (please see this page for more details).
This doesn't fully cover the whole SQL syntax of CockroachDB. It's a work in progress and contributions are welcome.
- Supports ALTER PRIMARY KEY
- Supports specifying an index in a CREATE TABLE statement
- Supports DROP INDEX
<table>@<index_name>
syntax - Supports STRING data type
- Supports storing index
- Supports unnamed index
- Index tracking and validation has been disabled until there's a way to track unnamed indexes
- Blob types (BYTEA, BLOB, BYTES)
- Integer types (32bit and 64bit aliases)
- Specify precision to TIMESTAMPTZ
- Specify table storage options
- Setting Locality
- Currently via ALTER TABLE
- Adding/Dropping regions
- Setting survival goal
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.
A snapshot release is built and released on the maven snapshot repo. To use a snapshot release, follow these steps:
- Add the maven snapshot repo to your project
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
mavenContent {
snapshotsOnly()
}
}
- 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 release1.0
and1.1
and there are commits prior to 1.1 being released, the version for a snapshot release in between will be1.0
. You can find the version by looking in thegradle.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.