Python: Add up-/downgrade scripts

In the upgrade direction, we simply do nothing.

In the downgrade direction, we remove the two new relations, and
also any `Stmt` nodes corresponding to `TypeAlias` nodes.
This commit is contained in:
Taus
2023-11-03 14:51:58 +00:00
parent 9cd1e0e546
commit 878299823c
7 changed files with 4883 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
// We must wrap the DB types, as these cannot appear in argument lists
class Stmt_ extends @py_stmt {
string toString() { result = "Stmt" }
}
class StmtList_ extends @py_stmt_list {
string toString() { result = "StmtList" }
}
query predicate py_stmts_without_typealias(Stmt_ id, int kind, StmtList_ parent, int idx) {
py_stmts(id, kind, parent, idx) and
// From the dbscheme:
//
// case @py_stmt.kind of
// ...
// | 27 = @py_TypeAlias;
kind != 27
}

View File

@@ -0,0 +1,5 @@
description: Remove support for type parameters and type alias statements
compatibility: backwards
py_type_parameters.rel: delete
py_type_parameter_lists.rel: delete
py_stmts.rel: run py_stmts.qlo py_stmts_without_typealias

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Add support for type parameters and type alias statements
compatibility: backwards