Skip to content

Commit 3c54d27

Browse files
committed
Merge branch 'issues'
2 parents 887a292 + 0c6beb8 commit 3c54d27

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sdk/mpr/writer_units.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ import (
1313
"github.com/mendixlabs/mxcli/sdk/domainmodel"
1414
)
1515

16+
// updateTransactionID updates the _Transaction table with a new UUID.
17+
// Studio Pro uses this to detect external changes during F4 sync.
18+
// Only applies to MPR v2 projects (Mendix >= 10.18).
19+
func (w *Writer) updateTransactionID() {
20+
if w.reader.version != MPRVersionV2 {
21+
return
22+
}
23+
newID := generateUUID()
24+
_, _ = w.reader.db.Exec(`UPDATE _Transaction SET LastTransactionID = ?`, newID)
25+
}
26+
1627
// placeholderBinaryPrefix is the GUID-swapped byte pattern for placeholder IDs generated
1728
// by sdk/widgets/augment.go placeholderID(). These are "aa000000000000000000000000XXXXXX"
1829
// hex strings which, after hex decode + GUID byte-swap, produce 16-byte blobs whose first
@@ -70,6 +81,7 @@ func (w *Writer) insertUnit(unitID, containerID, containmentName, unitType strin
7081
`, unitIDBlob, containerIDBlob, containmentName, contentsHash)
7182
if err == nil {
7283
w.reader.InvalidateCache()
84+
w.updateTransactionID()
7385
}
7486
return err
7587
}
@@ -126,6 +138,7 @@ func (w *Writer) updateUnit(unitID string, contents []byte) error {
126138
`, contentsHash, unitIDBlob)
127139
if err == nil {
128140
w.reader.InvalidateCache()
141+
w.updateTransactionID()
129142
}
130143
return err
131144
}
@@ -182,6 +195,7 @@ func (w *Writer) deleteUnit(unitID string) error {
182195
}
183196

184197
w.reader.InvalidateCache()
198+
w.updateTransactionID()
185199
return nil
186200
}
187201

0 commit comments

Comments
 (0)