generated from liquibase/liquibase-extension-example
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support "Advanced" level validation (#28)
* Created tests for advanced support * Contributed Test Harness Project - AddColumn, init.sql Set up support to begin running contributed tests with init script, and addColumn change type tests passing * Add more contributed tests * Update some foreign key constraints - Base Test Harness * Add more Base Tests * Add yet more base test functionality * Add table/columns/view remarks support - update Readme with progress * Add advanced tests * Finish Contributed Testing 1. Finished Contributed Tests (loadUpdateData, etc.) 2. Make GitActions do each testing level in series to not disturb the others * update readme * Add more advanced testing 1. Fix Foreign Key Snapshotting 2. Start createIndex change type mapping to CLUSTER BY * Add Support For: CheckConstraints, Optimize, Analyze, ClusteredTables Add Databricks specific change type support. * Update Terraform to use new DBR LTS 13.3 * Add support for creating partitioned tables Add support and tests for creating partitioned tables * Test Terraform Catalog Issue * Finish Advanced Test Harness Finish Advanced Test Harness * Update Terraform to use DBSQL warehouse for testing * troubleshoot terraform deployment * switch back id to name in tf deployment * Update test.yml Updating to the most recent version of the build logic to see if the Sonar scan issue is fixed. * update dbsql creation terrafor for testing * remove bad tf parameter from test harness --------- Co-authored-by: CodyAustinDavis <[email protected]> Co-authored-by: Kevin Chappell <[email protected]>
- Loading branch information
1 parent
cf899ab
commit d063292
Showing
177 changed files
with
4,190 additions
and
223 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
|
||
<!-- Changes to include --> | ||
<includeAll path="project/changes/"/> | ||
|
||
</databaseChangeLog> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
|
||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> | ||
|
||
<changeSet id="3" author="example"> | ||
<ext:createTable tableName="managed_system" tableFormat="delta"> | ||
<column name="id" type="int"/> | ||
<column name="name" type="varchar(20)"/> | ||
</ext:createTable> | ||
</changeSet> | ||
|
||
<changeSet id="4" author="example"> | ||
<createTable tableName="user_table"> | ||
<column name="id" type="int"/> | ||
<column name="username" type="varchar(20)"/> | ||
<column name="password" type="varchar(20)"/> | ||
</createTable> | ||
</changeSet> | ||
|
||
<changeSet id="5" author="example"> | ||
<ext:optimize tableName="user_table" zorderColumns="id"/> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
databaseChangeLog: | ||
|
||
- changeSet: | ||
id: 1 | ||
author: codydavis | ||
changes: | ||
- createTable: | ||
catalogName: main | ||
schemaName: liquibase | ||
tableName: test_yml | ||
columns: | ||
- column: | ||
name: id | ||
type: bigint | ||
autoIncrement: true | ||
|
||
- column: | ||
name: name_of_col | ||
type: string | ||
|
||
- column: | ||
name: test_struct | ||
type: STRUCT<ID string, name string> |
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
105 changes: 105 additions & 0 deletions
105
...iquibase/ext/databricks/change/addCheckConstraint/AddCheckConstraintChangeDatabricks.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package liquibase.ext.databricks.change.addCheckConstraint; | ||
|
||
import liquibase.change.*; | ||
import liquibase.database.Database; | ||
import liquibase.ext.databricks.change.dropCheckConstraint.DropCheckConstraintChangeDatabricks; | ||
import liquibase.ext.databricks.database.DatabricksDatabase; | ||
import liquibase.statement.SqlStatement; | ||
import java.text.MessageFormat; | ||
import liquibase.ext.databricks.database.DatabricksDatabase; | ||
|
||
@DatabaseChange(name = "addCheckConstraint", | ||
description = "Adds check constraint to Delta Table", | ||
priority = DatabricksDatabase.PRIORITY_DEFAULT + 200, | ||
appliesTo = {"column"} | ||
) | ||
public class AddCheckConstraintChangeDatabricks extends AbstractChange { | ||
|
||
private String catalogName; | ||
private String schemaName; | ||
private String tableName; | ||
|
||
private String constraintName; | ||
|
||
private String constraintBody; | ||
|
||
public String getCatalogName() { | ||
return catalogName; | ||
} | ||
|
||
public void setCatalogName (String catalogName) { | ||
this.catalogName = catalogName; | ||
} | ||
|
||
public String getTableName() { | ||
return tableName; | ||
} | ||
|
||
public void setTableName (String tableName) { | ||
this.tableName = tableName; | ||
} | ||
|
||
public String getSchemaName() { | ||
return schemaName; | ||
} | ||
|
||
public void setSchemaName (String schemaName) { | ||
this.schemaName = schemaName; | ||
} | ||
|
||
|
||
// Name of Delta Table Constraint | ||
@DatabaseChangeProperty( | ||
description = "Name of the check constraint" | ||
) | ||
public String getConstraintName() { | ||
return this.constraintName; | ||
} | ||
|
||
public void setConstraintName(String name) { | ||
this.constraintName = name; | ||
} | ||
|
||
|
||
// The is the SQL expression involving the contraint | ||
|
||
@DatabaseChangeProperty( | ||
serializationType = SerializationType.DIRECT_VALUE | ||
) | ||
public String getConstraintBody() { | ||
return this.constraintBody; | ||
} | ||
|
||
public void setConstraintBody(String body) { | ||
this.constraintBody = body; | ||
} | ||
|
||
@Override | ||
public String getConfirmationMessage() { | ||
return MessageFormat.format("{0}.{1}.{2} successfully Added check constraint {3}.", getCatalogName(), getSchemaName(), getTableName(), getConstraintName()); | ||
} | ||
|
||
protected Change[] createInverses() { | ||
DropCheckConstraintChangeDatabricks var1 = new DropCheckConstraintChangeDatabricks(); | ||
var1.setTableName(getTableName()); | ||
var1.setSchemaName(getSchemaName()); | ||
var1.setCatalogName(getCatalogName()); | ||
var1.setConstraintName(getConstraintName()); | ||
|
||
return new Change[]{var1}; | ||
} | ||
|
||
@Override | ||
public SqlStatement[] generateStatements(Database database) { | ||
|
||
AddCheckConstraintStatementDatabricks statement = new AddCheckConstraintStatementDatabricks(); | ||
|
||
statement.setCatalogName(getCatalogName()); | ||
statement.setSchemaName(getSchemaName()); | ||
statement.setTableName(getTableName()); | ||
statement.setConstraintName(getConstraintName()); | ||
statement.setConstraintBody(getConstraintBody()); | ||
|
||
return new SqlStatement[] {statement}; | ||
} | ||
} |
Oops, something went wrong.