I’m not sure whether this is a technical issue, so I’m trying the forums before creating a github issue.
I wanted to use the <uniqueConstraintExists> pre-condition in a changeset, and it worked fine using these parameters:
<preConditions onFail="MARK_RAN">
<not>
<uniqueConstraintExists
tableName="myTable"
constraintName="myConstraint"
/>
</not>
</preConditions>
This worked fine for MSSQL, but failed for MySQL and MariaDB (we support those 3 DBMS). I did some digging, and found that I have to provide the catalog name for the constraint - otherwise, an existing constraint won’t be detected:
<preConditions onFail="MARK_RAN">
<not>
<uniqueConstraintExists
tableName="myTable"
constraintName="myConstraint"
catalogName="myDatabaseName"
/>
</not>
</preConditions>
I did some more digging, and detected this snippet in the UniqueConstranitSnapshotGenerator, line 173 (Community 5.0):
String query = "..."
.append(String.format("where const.constraint_schema='%s' ", database.correctObjectName(schema.getCatalogName(), Catalog.class)));
This confused me, as the respective column contains the schema name, not the catalog name - the catalog is not really defined in MySQL/MariaDB as far as I know. Is there some fundamental misunderstanding from my part, or should i open a ticket on GitHub?