Last active
May 4, 2020 22:02
-
-
Save neilmcguigan/6db6e409db997081c20f9449ebce9fc0 to your computer and use it in GitHub Desktop.
Redshift Liquibase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--liquibase formatted sql | |
--changeset neil:1 | |
create table foo ( | |
id int | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./liquibase update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment