initializeBranchProvenance function in BranchProvenanceInitializer.ts takes in ProvenanceInitArgs which contains a
master and branch property of type IModelDb. Currently initializeBranchProvenance assumes that master and branch are identical, but that is not enforced.
How we could enforce it:
Compare the hash of each element in the branch to the hash of the same element (with the same id) in master. Fail if not equal.
SELECT ECInstanceId
FROM bis.Element branchElem
JOIN master.bis.Element masterElem
WHERE sha3(branchElem.$) != sha3(masterElem.$)
LIMIT 1
We can repeat the above for relationships (bis.ElementRefersToElement) and aspects (bis.ElementMultiAspect, bis.ElementUniqueAspect).
The above seems sufficient, but we could also, in addition, compare the sha1 checksum of ec schemas, ec maps and db schemas.
PRAGMA checksum(ecdb_schema);
Concerns
Performance implications? How long will this take?
initializeBranchProvenance
function in BranchProvenanceInitializer.ts takes inProvenanceInitArgs
which contains amaster
andbranch
property of type IModelDb. Currently initializeBranchProvenance assumes that master and branch are identical, but that is not enforced.How we could enforce it: Compare the hash of each element in the branch to the hash of the same element (with the same id) in master. Fail if not equal.
We can repeat the above for relationships (bis.ElementRefersToElement) and aspects (bis.ElementMultiAspect, bis.ElementUniqueAspect).
The above seems sufficient, but we could also, in addition, compare the sha1 checksum of ec schemas, ec maps and db schemas.
Concerns
Performance implications? How long will this take?