Back to Flyway

CockroachDB

documentation/Reference/Database Driver Reference/CockroachDB.md

latest3.1 KB
Original Source
  • Verified Versions: v21.2, v25.2
  • Maintainer: {% include redgate-badge.html %}

Supported Versions and Support Levels

{% include database-boilerplate.html %}

Driver

ItemDetails
URL format<code>jdbc:postgresql://<i>host</i>:<i>port</i>/<i>database</i></code>
SSL supportYes
Ships with Flyway Command-lineYes
Maven Central coordinatesorg.postgresql:postgresql
Supported versions9.3-1104-jdbc4 and later
Default Java classorg.postgresql.Driver

Java Usage

CockroachDB support is a separate dependency for Flyway and will need to be added to your Java project to access these features. CockroachDB is found within the flyway-database-postgresql plugin module.

Maven

Redgate

xml
<dependency>
    <groupId>com.redgate.flyway</groupId>
    <artifactId>flyway-database-postgresql</artifactId>
</dependency>

Open Source

xml
<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-database-postgresql</artifactId>
</dependency>

Gradle

Redgate

groovy
buildscript {
    dependencies {
        implementation "com.redgate.flyway:flyway-database-postgresql"
    }
}

Open Source

groovy
buildscript {
    dependencies {
        implementation "org.flywaydb:flyway-database-postgresql"
    }
}

SQL Script Syntax

  • Standard SQL syntax with statement delimiter ;

Compatibility

  • DDL exported by pg_dump can be used unchanged in a Flyway migration.
  • Any CockroachDB sql script executed by Flyway, can be executed by the CockroachDB command-line tool and other PostgreSQL-compatible tools (after the placeholders have been replaced).

Example

sql
/* Single line comment */
CREATE TABLE test_data (
 value VARCHAR(25) NOT NULL PRIMARY KEY
);


/*
Multi-line
comment
*/

-- Placeholder
INSERT INTO ${tableName} (name) VALUES ('Mr. T');

Limitations

  • No support for PSQL meta-commands with no JDBC equivalent like \set

Additional Information

  • See CockroachDB's walk-through on using Flyway here