Class TableSchemaFingerprint
java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.tables.TableSchemaFingerprint
A stable SHA-256 fingerprint of the persistent shape of a table, together
with the descriptor (canonical JSON) it was computed from.
The descriptor covers only what affects stored data:
- the table name, primary key field and backend type;
- each field's name, type, isRequired, maxLength, possible-value-source
name, isHeavy and isSensitive (sorted by field name);
- the unique keys (field names sorted within a key, keys sorted) and
associations (sorted by name).
Labels, adornments, help text and other cosmetic metadata are left out on
purpose, so changing them does not change the fingerprint. Field order
does not matter either.
Use SchemaDiff to see what changed between two fingerprints.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanFingerprints are equal when their hashes are.static TableSchemaFingerprintfromDescriptorJson(String json) Rebuild a fingerprint from a stored descriptor (as returned by getDescriptorJson), e.g., one saved in a backup manifest.The descriptor as maps and lists (a fresh copy on each call).The canonical JSON the hash was computed from: sorted keys, no whitespace.getHash()The SHA-256 of the canonical descriptor JSON, as lower-case hex.inthashCode()static TableSchemaFingerprintof(QTableMetaData table) Fingerprint a table.static TableSchemaFingerprintof(QTableMetaData table, String backendType) Fingerprint a table, with an explicit backend type.toString()
-
Method Details
-
of
Fingerprint a table. The backend type comes from the table's backend in the current QContext instance, when there is one - else from the table's backend details - else is empty. Use the 2-arg overload to be explicit. -
of
Fingerprint a table, with an explicit backend type. -
fromDescriptorJson
Rebuild a fingerprint from a stored descriptor (as returned by getDescriptorJson), e.g., one saved in a backup manifest. The JSON is re-canonicalized, so the hash is the same as the original's. -
getHash
The SHA-256 of the canonical descriptor JSON, as lower-case hex. -
getDescriptorJson
The canonical JSON the hash was computed from: sorted keys, no whitespace. -
getDescriptor
-
equals
-
hashCode
-
toString
-