Want to deploy your JVM, Node.js and Go apps effortlessly to AWS? Try our service Boxfuse

Redshift

Driver

Redshift
Supported versions 1.2.10.1009 and later
URL format jdbc:redshift://host:port/database
Ships with Flyway Command-line No
Download Follow the instructions at docs.aws.amazon.com
Default Java class com.amazon.redshift.jdbc42.Driver

SQL Script Syntax

  • Standard SQL syntax with statement delimiter ;
  • Stored procedures (CREATE FUNCTION with $$ escapes)

Compatibility

  • DDL exported by pg_dump can be used unchanged in a Flyway migration. Please note that Redshift does not support exporting data using pg_dump, so you must export only the schema, using pg_dump -s.
  • Any Redshift SQL script executed by Flyway, can be executed by the PostgreSQL command-line tool and other PostgreSQL-compatible tools, such as SQL Workbench/J (after the placeholders have been replaced).

Example

/* Single line comment */
CREATE TABLE test_data (
  test_id INT IDENTITY NOT NULL PRIMARY KEY,
  value VARCHAR(25) NOT NULL
);

/*
Multi-line
comment
*/
INSERT INTO test_data (value) VALUES ('Hello');

CREATE VIEW value_only AS SELECT value FROM test_data;

CREATE TABLE another_table AS SELECT 'some-data' as name;

CREATE FUNCTION add(integer, integer) RETURNS integer
     IMMUTABLE
    AS $$
    select $1 + $2;
$$ LANGUAGE sql;

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

Limitations

Due to Redshift limitations DROP TABLE for external tables cannot run within a transaction, yet Flyway doesn’t autodetect this. You can work around this limitation and successfully execute such a statement by including a VACUUM statement in the same SQL file as this will force Flyway to run the entire migration without a transaction.

CockroachDB