Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-16713



 DevOps :: LocalStack for Snowflake Emulation #726

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b52dd3f
fix(snowflake.yml): update snowflake url to use localstack for testin…
Jan 26, 2024
feb8d6d
fix(snowflake.yml): change snowflake connection URL from "snowflake:/…
Jan 26, 2024
90809d8
chore(snowflake.yml): remove unused drop-all step to simplify the wor…
Jan 26, 2024
0d1a6a5
chore(snowflake.yml): remove unnecessary liquibase-github-action step
Jan 26, 2024
9d64e43
fix(snowflake.yml): fix the order of commands in the workflow to ensu…
Jan 26, 2024
710614b
fix(snowflake.yml): update TH_SNOW_URL environment variable to includ…
Jan 26, 2024
3369320
fix(snowflake.yml): fix TH_SNOW_URL value to include http protocol fo…
Jan 26, 2024
6257f6f
fix(snowflake.yml): change localstack wait command to not specify a t…
Jan 29, 2024
56e3a41
chore(snowflake.yml): update python-version to 3.12.1 for compatibili…
Jan 29, 2024
e853a01
chore(snowflake.yml): add LIQUIBASE_PRO_LICENSE_KEY environment varia…
Jan 29, 2024
471fa86
fix(snowflake.yml): add DOCKER_FLAGS environment variable to enable t…
Feb 1, 2024
157070b
Merge branch 'main' into DAT-16713
jandroav Feb 1, 2024
6d12d96
fix(snowflake.yml): update liquibase command to use liquibase/liquiba…
Feb 1, 2024
e8dd282
chore(snowflake.yml): remove unused LIQUIBASE_PRO_LICENSE_KEY environ…
Feb 1, 2024
a93033d
chore(snowflake.yml): remove unnecessary Liquibase update step
Feb 1, 2024
a07773b
chore(snowflake.yml): update liquibase command to use the new environ…
Feb 1, 2024
ea4dad6
fix(snowflake.yml): add verbose flag (-X) to mvn command to enable de…
Feb 1, 2024
48590d9
fix(snowflake.yml): update LIQUIBASE_PRO_LICENSE_KEY environment vari…
Feb 1, 2024
7a6dbf6
refactor(TestUtils.groovy): remove alter table queries for databasech…
Feb 1, 2024
d9412ab
fix(liquibase): update table and column references in expected SQL sc…
Feb 1, 2024
ed74720
update tests
Feb 1, 2024
b596fe3
fix(liquibase): change table and sequence names to use lowercase "pub…
Feb 1, 2024
6265c81
fix(snowflake.yml): remove verbose logging flag from mvn command to r…
Feb 1, 2024
df2cf9f
Merge branch 'main' into DAT-16713
jandroav Feb 13, 2024
e1af76b
Merge branch 'main' into DAT-16713
jandroav Feb 26, 2024
b245a6c
adding IMAGE_NAME=localstack/snowflake
jandroav Feb 29, 2024
5a29461
Merge branch 'main' into DAT-16713
jandroav Apr 10, 2024
61fde9a
Merge branch 'main' into DAT-16713
jandroav Apr 16, 2024
84b5345
Merge branch 'main' into DAT-16713
jandroav Jun 3, 2024
c975e17
🔧 (snowflake.yml): update localstack wait command to include a timeou…
Jun 3, 2024
d6f37c8
🔧 (aws-weekly.yml): Update schedule to run the workflow every Sunday …
Jun 3, 2024
9b6e593
🔧 (aws-weekly.yml): Update workflow to use the 'main' branch for ephe…
Jun 3, 2024
362b9b8
🔧 (snowflake.yml): add 'continue-on-error: true' to the job to allow …
Jun 4, 2024
9e58ffd
🔧 (snowflake.yml): add 'continue-on-error' flag to the 'Update' steps…
Jun 4, 2024
22ef505
🔧 (snowflake.yml): add 'continue-on-error: true' to Update and Snowfl…
Jun 4, 2024
9240245
🔧 (snowflake.yml): add steps to get and archive logs from localstack-…
Jun 6, 2024
51a50ad
🔧 (snowflake.yml): Remove liquibase drop-all action to prevent uninte…
Jun 6, 2024
0394d94
fix conflicts
jandroav Oct 3, 2024
237ccce
fix conflicts
jandroav Oct 3, 2024
e4c1d2a
🔧 (snowflake.yml): remove deploy-ephemeral-cloud-infra job as it is n…
jandroav Oct 3, 2024
9c40bf4
Merge branch 'main' into DAT-16713
jandroav Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions .github/workflows/aws-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ jobs:
let splitValues = "${{ matrix.database }}".split(":")
core.setOutput("databasePlatform", splitValues[0]);
core.setOutput("databaseVersion", splitValues[1]);

- name: Get AWS secrets
if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
Expand Down Expand Up @@ -192,6 +191,51 @@ jobs:
secret-ids: |
TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}

- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }}
with:
Expand Down Expand Up @@ -259,7 +303,6 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }}
env:
Expand Down
100 changes: 61 additions & 39 deletions .github/workflows/snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@ on:

jobs:

deploy-ephemeral-cloud-infra:
uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main
secrets: inherit
with:
deploy: true
snowflake_th: true

test:
runs-on: ubuntu-latest
needs: [deploy-ephemeral-cloud-infra]
permissions:
contents: read
id-token: write
Expand All @@ -26,46 +18,76 @@ jobs:
- name: Checkout
uses: actions/checkout@v4


- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
- name: Setup Python
uses: actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }}
aws-region: us-east-1

- name: Get LIQUIBASETH secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_DB_ADMIN, liquibaseth_usrname
TH_DB_PASSWD, liquibaseth_pwd
python-version: '3.12.1'

- uses: liquibase/liquibase-github-action@v7
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/snowflake"
changeLogFile: "snowflake.sql"
username: "${{env.TH_DB_ADMIN}}"
password: "${{env.TH_DB_PASSWD}}"
url: "${{secrets.TH_SNOW_URL}}"
- name: Install liquibase
run: |
wget -O- https://repo.liquibase.com/liquibase.asc | gpg --dearmor > liquibase-keyring.gpg && \
cat liquibase-keyring.gpg | sudo tee /usr/share/keyrings/liquibase-keyring.gpg > /dev/null && \
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/liquibase-keyring.gpg] https://repo.liquibase.com stable main' | sudo tee /etc/apt/sources.list.d/liquibase.list
sudo apt-get update
sudo apt-get install liquibase

- name: Start & Configure LocalStack
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
continue-on-error: true
run: |
pip install localstack awscli-local
DEBUG=1 DOCKER_FLAGS='-e SF_LOG=trace' IMAGE_NAME=localstack/snowflake localstack start -d
echo "Waiting for LocalStack startup..."
echo "Waiting for LocalStack startup..."
localstack wait -t 30
echo "Startup complete"
echo "TH_DB_ADMIN=test" >> $GITHUB_ENV
echo "TH_DB_PASSWD=test" >> $GITHUB_ENV
echo "TH_DB=snowflake" >> $GITHUB_ENV
echo "TH_SNOW_URL=jdbc:snowflake://http://snowflake.localhost.localstack.cloud:4566" >> $GITHUB_ENV

- name: Update
continue-on-error: true
run: liquibase update --url="${{env.TH_SNOW_URL}}" --username="${{env.TH_DB_ADMIN}}" --password="${{env.TH_DB_PASSWD}}" --classpath="src/test/resources/init-changelogs/snowflake" --changeLogFile="snowflake.sql"

- name: Snowflake Test Run
continue-on-error: true
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=LiquibaseHarnessSuiteTest -DconfigFile=/harness-config-cloud.yml -DdbName=snowflake -DdbUsername=${{env.TH_DB_ADMIN}} -DdbPassword=${{env.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_SNOW_URL}}' -DrollbackStrategy=rollbackByTag test
run: mvn -Dtest=LiquibaseHarnessSuiteTest -DconfigFile=/harness-config-cloud.yml -DdbName=${{env.TH_DB}} -DdbUsername=${{env.TH_DB_ADMIN}} -DdbPassword=${{env.TH_DB_PASSWD}} -DdbUrl='${{env.TH_SNOW_URL}}' -DrollbackStrategy=rollbackByTag test

- name: Update
continue-on-error: true
if: always()
run: curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz

- name: Update
continue-on-error: true
if: always()
run: curl -s snowflake.localhost.localstack.cloud:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz

- name: Get logs from the localstack-main container
if: always()
run: |
docker logs localstack-main > localstack-main.log

- name: Archive LocalStack logs
if: always()
uses: actions/upload-artifact@v4
with:
name: localstack-logs
path: localstack-main.log

- name: Archive Snowflake Database Test Results
uses: actions/upload-artifact@v4
with:
name: snowflake-test-results
path: build/spock-reports

destroy-ephemeral-cloud-infra:
if: always()
needs: [ deploy-ephemeral-cloud-infra, test ]
uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main
secrets: inherit
with:
destroy: true
stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }}
snowflake_th: true

- name: Archive localstack diagnose
uses: actions/upload-artifact@v4
with:
name: localstack-diagnose
path: diagnose.json.gz
1 change: 1 addition & 0 deletions src/main/groovy/liquibase/harness/util/TestUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TestUtils {
if (script) {
script.replaceAll(/(?m)^--.*/, "") //remove comments
.replaceAll(/(?m)^CREATE TABLE .*\w*.*DATABASECHANGELOG.*/, "") //remove create table queries for databasechangelog* tables
.replaceAll(/(?m)^ALTER TABLE .*\w*.*DATABASECHANGELOG.*/, "") //remove alter table queries for databasechangelog* tables
.replaceAll(/(?m)^CREATE TABLE .*\w*.*databasechangelog.*/, "")
.replaceAll(/(?m)^INSERT INTO .*\w*.*DATABASECHANGELOG.*/, "") //remove insert queries for databasechangelog* tables
.replaceAll(/(?m)^INSERT INTO .*\w*.*databasechangelog.*/, "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<changeSet author="as" id="1">
<pro:createPackage encoding="UTF-8"
packageName="Test package">
CREATE TABLE "PUBLIC".test_table_package (test_id INT NOT NULL);
CREATE TABLE "public".test_table_package (test_id INT NOT NULL);
</pro:createPackage>
<rollback>
<dropTable tableName="test_table_package"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<changeSet author="as" id="1">
<pro:createPackageBody encoding="UTF-8"
packageBodyName="Test package">
CREATE TABLE "PUBLIC".test_table_package_body (test_id INT NOT NULL);
CREATE TABLE "public".test_table_package_body (test_id INT NOT NULL);
</pro:createPackageBody>
<rollback>
<dropTable tableName="test_table_package_body"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ALTER TABLE LTHDB.PUBLIC.authors ADD intColumn INT
ALTER TABLE LTHDB.PUBLIC.authors ADD dateColumn date
UPDATE LTHDB.PUBLIC.authors SET varcharColumn = 'INITIAL_VALUE'
UPDATE LTHDB.PUBLIC.authors SET intColumn = 5
UPDATE LTHDB.PUBLIC.authors SET dateColumn = '2020-09-21'
UPDATE LTHDB.PUBLIC.authors SET dateColumn = '2020-09-21'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT fk_posts_authors_test FOREIGN KEY (author_id) REFERENCES LTHDB.PUBLIC.authors (id)
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT fk_posts_authors_test FOREIGN KEY (author_id) REFERENCES LTHDB.PUBLIC.authors (id)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE LTHDB.PUBLIC.authors_data AS SELECT DISTINCT email AS authors_email FROM LTHDB.PUBLIC.authors WHERE email IS NOT NULL
ALTER TABLE LTHDB.PUBLIC.authors_data ALTER COLUMN authors_email SET NOT NULL
ALTER TABLE LTHDB.PUBLIC.authors_data ADD PRIMARY KEY (authors_email)
ALTER TABLE LTHDB.PUBLIC.authors ADD CONSTRAINT FK_AUTHORS_AUTHORS_DATA FOREIGN KEY (email) REFERENCES LTHDB.PUBLIC.authors_data (authors_email)
ALTER TABLE LTHDB.PUBLIC.authors ADD CONSTRAINT FK_AUTHORS_AUTHORS_DATA FOREIGN KEY (email) REFERENCES LTHDB.PUBLIC.authors_data (authors_email)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE LTHDB.PUBLIC.posts ALTER COLUMN inserted_date SET NOT NULL
ALTER TABLE LTHDB.PUBLIC.posts ALTER COLUMN inserted_date SET NOT NULL
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT pk_posts PRIMARY KEY (id)
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT pk_posts PRIMARY KEY (id)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE LTHDB.PUBLIC.authors ADD CONSTRAINT test_unique_constraint UNIQUE (email)
ALTER TABLE LTHDB.PUBLIC.authors ADD CONSTRAINT test_unique_constraint UNIQUE (email)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE SEQUENCE PUBLIC.test_sequence START WITH 1 INCREMENT BY 1
ALTER SEQUENCE PUBLIC.test_sequence INCREMENT BY 10
ALTER SEQUENCE PUBLIC.test_sequence INCREMENT BY 10
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE TABLE "PUBLIC".test_table_package (test_id INT NOT NULL)
CREATE TABLE "public".test_table_package (test_id INT NOT NULL)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE TABLE "PUBLIC".test_table_package_body (test_id INT NOT NULL)
CREATE TABLE "public".test_table_package_body (test_id INT NOT NULL)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE SEQUENCE PUBLIC.test_sequence START WITH 1 INCREMENT BY 5
CREATE SEQUENCE PUBLIC.test_sequence START WITH 1 INCREMENT BY 5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE TABLE LTHDB.PUBLIC.test_table (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL, CONSTRAINT PK_TEST_TABLE PRIMARY KEY (test_id))
CREATE TABLE LTHDB.PUBLIC.test_table (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL, CONSTRAINT PK_TEST_TABLE PRIMARY KEY (test_id))
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE TABLE LTHDB.PUBLIC.createTableDataTypeDoubleIsFloat (floatCol FLOAT)
CREATE TABLE LTHDB.PUBLIC.createTableDataTypeDoubleIsFloat (floatCol FLOAT)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE TABLE LTHDB.PUBLIC.createTableDataTypeText (textCol TEXT)
CREATE TABLE LTHDB.PUBLIC.createTableDataTypeText (textCol TEXT)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE TABLE LTHDB.PUBLIC.lms_create_table_test (lms_test_id INT, lms_test_timestamp timestamp)
CREATE TABLE LTHDB.PUBLIC.lms_create_table_test (lms_test_id INT, lms_test_timestamp timestamp)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CREATE VIEW LTHDB.PUBLIC.test_view AS select id, first_name, last_name, email from authors
CREATE VIEW LTHDB.PUBLIC.test_view AS select id, first_name, last_name, email from authors
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT fk_posts_authors_test_1 FOREIGN KEY (author_id) REFERENCES LTHDB.PUBLIC.authors (id)
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT fk_posts_authors_test_2 FOREIGN KEY (id) REFERENCES LTHDB.PUBLIC.authors (id)
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT fk_posts_authors_test_2 FOREIGN KEY (id) REFERENCES LTHDB.PUBLIC.authors (id)
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ALTER TABLE LTHDB.PUBLIC.posts ADD varcharColumn VARCHAR(25)
UPDATE LTHDB.PUBLIC.posts SET varcharColumn = 'INITIAL_VALUE'
ALTER TABLE LTHDB.PUBLIC.posts DROP COLUMN varcharColumn
ALTER TABLE LTHDB.PUBLIC.posts DROP COLUMN varcharColumn
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE TABLE LTHDB.PUBLIC.dropDefaultTest (id INT, stringColumn STRING DEFAULT 'testDefault')
ALTER TABLE LTHDB.PUBLIC.dropDefaultTest ALTER COLUMN stringColumn DROP DEFAULT
ALTER TABLE LTHDB.PUBLIC.dropDefaultTest ALTER COLUMN stringColumn DROP DEFAULT
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT fk_posts_authors_test FOREIGN KEY (author_id) REFERENCES LTHDB.PUBLIC.authors (id)
ALTER TABLE LTHDB.PUBLIC.posts DROP CONSTRAINT fk_posts_authors_test
ALTER TABLE LTHDB.PUBLIC.posts DROP CONSTRAINT fk_posts_authors_test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE OR REPLACE FUNCTION test_function()
returns float
as '3.141592654::FLOAT'
DROP FUNCTION PUBLIC.test_function()
DROP FUNCTION PUBLIC.test_function()
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ALTER TABLE LTHDB.PUBLIC.posts ALTER COLUMN inserted_date SET NOT NULL
ALTER TABLE LTHDB.PUBLIC.posts ALTER COLUMN inserted_date DROP NOT NULL
ALTER TABLE LTHDB.PUBLIC.posts ALTER COLUMN inserted_date DROP NOT NULL
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ALTER TABLE LTHDB.PUBLIC.posts ADD CONSTRAINT pk_posts PRIMARY KEY (id)
ALTER TABLE LTHDB.PUBLIC.posts DROP PRIMARY KEY
ALTER TABLE LTHDB.PUBLIC.posts DROP PRIMARY KEY
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE SEQUENCE PUBLIC.test_sequence START WITH 1 INCREMENT BY 1
DROP SEQUENCE PUBLIC.test_sequence
DROP SEQUENCE PUBLIC.test_sequence
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE TABLE LTHDB.PUBLIC.test_table (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL, CONSTRAINT PK_TEST_TABLE PRIMARY KEY (test_id))
DROP TABLE LTHDB.PUBLIC.test_table
DROP TABLE LTHDB.PUBLIC.test_table
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ALTER TABLE LTHDB.PUBLIC.authors ADD CONSTRAINT test_unique_constraint UNIQUE (email)
ALTER TABLE LTHDB.PUBLIC.authors DROP CONSTRAINT test_unique_constraint
ALTER TABLE LTHDB.PUBLIC.authors DROP CONSTRAINT test_unique_constraint
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE VIEW LTHDB.PUBLIC.test_view AS select id, first_name, last_name, email from authors
DROP VIEW LTHDB.PUBLIC.test_view
DROP VIEW LTHDB.PUBLIC.test_view
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ UPDATE LTHDB.PUBLIC.full_name_table SET last_name = 'Doe' WHERE first_name='Jane
ALTER TABLE LTHDB.PUBLIC.full_name_table ADD full_name VARCHAR(255)
UPDATE LTHDB.PUBLIC.full_name_table SET full_name = first_name || ' ' || last_name
ALTER TABLE LTHDB.PUBLIC.full_name_table DROP COLUMN first_name
ALTER TABLE LTHDB.PUBLIC.full_name_table DROP COLUMN last_name
ALTER TABLE LTHDB.PUBLIC.full_name_table DROP COLUMN last_name
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE TABLE LTHDB.PUBLIC.modify_data_type_test (intColumn NUMBER(10), intColumn2 NUMBER(30))
ALTER TABLE LTHDB.PUBLIC.modify_data_type_test ALTER COLUMN intColumn TYPE NUMBER(20)
ALTER TABLE LTHDB.PUBLIC.modify_data_type_test ALTER COLUMN intColumn TYPE NUMBER(20)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/* prepend comment */ CREATE TABLE LTHDB.PUBLIC.test_table (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL) -- append comment
/* prepend comment */ CREATE TABLE LTHDB.PUBLIC.test_table (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL) -- append comment
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE LTHDB.PUBLIC.authors RENAME COLUMN first_name TO first_name_renameColumn_test
ALTER TABLE LTHDB.PUBLIC.authors RENAME COLUMN first_name TO first_name_renameColumn_test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE SEQUENCE PUBLIC.test_sequence START WITH 1 INCREMENT BY 1
ALTER SEQUENCE PUBLIC.test_sequence RENAME TO test_sequence_rename_test
ALTER SEQUENCE PUBLIC.test_sequence RENAME TO test_sequence_rename_test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE TABLE LTHDB.PUBLIC.oldnametable (test_id INT NOT NULL, test_column VARCHAR(50) NOT NULL, CONSTRAINT PK_OLDNAMETABLE PRIMARY KEY (test_id))
ALTER TABLE LTHDB.PUBLIC.oldnametable RENAME TO LTHDB.PUBLIC.newnametable
ALTER TABLE LTHDB.PUBLIC.oldnametable RENAME TO LTHDB.PUBLIC.newnametable
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE VIEW LTHDB.PUBLIC.test_view AS select id, first_name, last_name, email from authors
ALTER VIEW LTHDB.PUBLIC.test_view RENAME TO LTHDB.PUBLIC.test_view_new
ALTER VIEW LTHDB.PUBLIC.test_view RENAME TO LTHDB.PUBLIC.test_view_new
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COMMENT ON COLUMN LTHDB.PUBLIC.authors.id IS 'A Test Column Remark'
COMMENT ON COLUMN LTHDB.PUBLIC.authors.id IS 'A Test Column Remark'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COMMENT ON TABLE LTHDB.PUBLIC.authors IS 'A Test Remark'
COMMENT ON TABLE LTHDB.PUBLIC.authors IS 'A Test Remark'
Loading
Loading