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

feat: Generated Snapshots should reference Databricks XSD #193

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package liquibase.ext.databricks.parser;

import liquibase.parser.LiquibaseParser;
import liquibase.parser.NamespaceDetails;
import liquibase.parser.core.xml.XMLChangeLogSAXParser;
import liquibase.serializer.LiquibaseSerializer;
import liquibase.serializer.core.xml.XMLChangeLogSerializer;

/**
* Namespace details for Databricks extension.
* It is used by Liquibase when generating changelogs - ie during a snapshot.
*/
public class NamespaceDetailsDatabricks implements NamespaceDetails {

public static final String DATABRICKS_NAMESPACE = "http://www.liquibase.org/xml/ns/databricks";

public static final String DATABRICKS_XSD = "http://www.liquibase.org/xml/ns/databricks/liquibase-databricks-latest.xsd";

@Override
public int getPriority() {
return PRIORITY_EXTENSION;
}

@Override
public boolean supports(LiquibaseSerializer serializer, String namespace) {
return namespaceCorrect(namespace) && serializer instanceof XMLChangeLogSerializer;
}

@Override
public boolean supports(LiquibaseParser parser, String namespace) {
return namespaceCorrect(namespace) && parser instanceof XMLChangeLogSAXParser;
}

@Override
public String getShortName(String namespace) {
return "databricks";
}

@Override
public String getSchemaUrl(String namespace) {
return DATABRICKS_XSD;
}

@Override
public String[] getNamespaces() {
return new String[]{
DATABRICKS_NAMESPACE
};
}

private boolean namespaceCorrect(String namespace) {
return namespace.equals(DATABRICKS_NAMESPACE) || namespace.equals(DATABRICKS_XSD);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
liquibase.ext.databricks.parser.NamespaceDetailsDatabricks
Loading