Skip to content

Instantly share code, notes, and snippets.

@neilmcguigan
Last active May 4, 2020 22:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilmcguigan/6db6e409db997081c20f9449ebce9fc0 to your computer and use it in GitHub Desktop.
Save neilmcguigan/6db6e409db997081c20f9449ebce9fc0 to your computer and use it in GitHub Desktop.
Redshift Liquibase
# TAG is a Redshift keyword, so we have to create this table ourselves, and quote TAG
# otherwise, you need a custom database class for liquibase
# see https://github.com/liquibase/liquibase-redshift
CREATE TABLE public.databasechangelog (
ID VARCHAR(255) NOT NULL,
AUTHOR VARCHAR(255) NOT NULL,
FILENAME VARCHAR(255) NOT NULL,
DATEEXECUTED TIMESTAMP WITHOUT TIME ZONE NOT NULL,
ORDEREXECUTED INTEGER NOT NULL,
EXECTYPE VARCHAR(10) NOT NULL,
MD5SUM VARCHAR(35),
DESCRIPTION VARCHAR(255),
COMMENTS VARCHAR(255),
"TAG" VARCHAR(255), # the important part
LIQUIBASE VARCHAR(20),
CONTEXTS VARCHAR(255),
LABELS VARCHAR(255),
DEPLOYMENT_ID VARCHAR(10)
)
# https://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html
driver=com.amazon.redshift.jdbc42.Driver
classpath=RedshiftJDBC42-no-awssdk-1.2.41.1065.jar
url=jdbc:redshift://$CLUSTER_ENDPOINT # AWS Console > Redshift > Your Cluster > Properties > Connection Details
currentDateTimeFunction=getdate()
username=awsuser
password=youProbablyShouldntPutThisHere
changeLogFile=my-schema.sql
logLevel=debug
--liquibase formatted sql
--changeset neil:1
create table foo (
id int
)
./liquibase update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment