CockroachDB

CockroachDB

  • Verified Versions: 1.1, 21.1
  • Maintainer: Redgate

Supported Versions and Support Levels

Driver

Item Details
URL format jdbc:postgresql://host:port/database
SSL support Yes
Ships with Flyway Command-line Yes
Maven Central coordinates org.postgresql:postgresql
Supported versions 9.3-1104-jdbc4 and later
Default Java class org.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

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

Open Source

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

Gradle

Redgate

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

Open Source

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

SQL Script Syntax

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

/* 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 walkthrough on using Flyway here

Didn't find what you were looking for?