fix(dameng): use ALTER TABLE constraints for unique indexes
This commit is contained in:
1 parent
a19a77c6df
commit
124819e1fa
27 files changed
+466
-10
No files matched your search
@@ -18,6 +18,12 @@ public final class IndexInfo {
|
||||
// doesn't track this (provenance unknown for that dialect/path). Mirrors
|
||||
// crate::types::IndexInfo::key_is_expression on the Rust side (#6312 review).
|
||||
private List<Boolean> key_is_expression;
|
||||
// True when this index is the object behind a table constraint (PRIMARY KEY / UNIQUE)
|
||||
// instead of a standalone index. Dameng lists both kinds in ALL_INDEXES but only accepts
|
||||
// index-level DDL for standalone ones, so the SQL builder needs to tell them apart
|
||||
// (#7959). Mirrors crate::types::IndexInfo::constraint_backed on the Rust side; false
|
||||
// when the introspection source doesn't report it.
|
||||
private boolean constraint_backed;
|
||||
|
||||
public IndexInfo() {
|
||||
this("", Collections.emptyList(), false, false);
|
||||
@@ -98,6 +104,10 @@ public final class IndexInfo {
|
||||
return key_is_expression;
|
||||
}
|
||||
|
||||
public boolean getConstraint_backed() {
|
||||
return constraint_backed;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -134,6 +144,10 @@ public final class IndexInfo {
|
||||
this.key_is_expression = key_is_expression;
|
||||
}
|
||||
|
||||
public void setConstraint_backed(boolean constraint_backed) {
|
||||
this.constraint_backed = constraint_backed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) return true;
|
||||
@@ -141,6 +155,7 @@ public final class IndexInfo {
|
||||
IndexInfo that = (IndexInfo) other;
|
||||
return is_unique == that.is_unique
|
||||
&& is_primary == that.is_primary
|
||||
&& constraint_backed == that.constraint_backed
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(columns, that.columns)
|
||||
&& Objects.equals(filter, that.filter)
|
||||
@@ -153,7 +168,16 @@ public final class IndexInfo {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
name, columns, is_unique, is_primary, filter, index_type, included_columns, comment, key_is_expression
|
||||
name,
|
||||
columns,
|
||||
is_unique,
|
||||
is_primary,
|
||||
filter,
|
||||
index_type,
|
||||
included_columns,
|
||||
comment,
|
||||
key_is_expression,
|
||||
constraint_backed
|
||||
);
|
||||
}
|
||||
|
||||
@@ -168,6 +192,7 @@ public final class IndexInfo {
|
||||
+ ", included_columns=" + included_columns
|
||||
+ ", comment=" + comment
|
||||
+ ", key_is_expression=" + key_is_expression
|
||||
+ ", constraint_backed=" + constraint_backed
|
||||
+ ")";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user