Skip to content

Commit 15023a7

Browse files
Rust: Add schema upgrade, downgrade and change note
1 parent fbcbe1f commit 15023a7

8 files changed

Lines changed: 15065 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class Element extends @element {
2+
string toString() { none() }
3+
}
4+
5+
class Location extends @location_default {
6+
string toString() { none() }
7+
}
8+
9+
// The new node kinds have no representation in the old schema. Their own relations are dropped via
10+
// `delete` in upgrade.properties; their `locatable_locations` rows are scrubbed below.
11+
private predicate deletedNode(Element id) { cfg_pred_exprs(id) or cfg_pred_pats(id) }
12+
13+
// A deleted node, plus any comment attached to one: dropping the comment's `comments` row would
14+
// otherwise leave its `locatable_locations` row dangling.
15+
private predicate deletedElement(Element id) {
16+
deletedNode(id)
17+
or
18+
exists(Element parent | comments(id, parent, _) and deletedNode(parent))
19+
}
20+
21+
query predicate new_locatable_locations(Element id, Location location) {
22+
locatable_locations(id, location) and not deletedElement(id)
23+
}

0 commit comments

Comments
 (0)