Skip to content

Commit 188f6e6

Browse files
committed
Update drop_before_all to support fhir-schema and old approach. Closes #68
1 parent 63e9933 commit 188f6e6

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.12
2+
3+
- Update drop_before_all to support fhir-schema and old approach #68
4+
15
## 0.1.11
26

37
- Add `headers` to SDKOperationRequest

aidbox_python_sdk/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = "aidbox-python-sdk"
2-
__version__ = "0.1.11"
2+
__version__ = "0.1.12"
33
__author__ = "beda.software"
44
__license__ = "None"
55
__copyright__ = "Copyright 2024 beda.software"

aidbox_python_sdk/db_migrations.py

+22-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,26 @@
1313
END LOOP;
1414
END;
1515
16-
$$ LANGUAGE plpgsql;
17-
""",
18-
}
16+
$$ LANGUAGE plpgsql;""",
17+
},
18+
{
19+
"id": "20240913_change_drop_before_all",
20+
"sql": """
21+
DROP FUNCTION IF EXISTS drop_before_all(integer);
22+
23+
CREATE FUNCTION drop_before_all(integer) RETURNS VOID AS $$
24+
declare
25+
e record;
26+
BEGIN
27+
FOR e IN (
28+
SELECT table_name
29+
FROM information_schema.columns
30+
WHERE column_name = 'txid' AND table_schema = 'public' AND table_name NOT LIKE '%_history'
31+
) LOOP
32+
EXECUTE 'DELETE FROM "' || e.table_name || '" WHERE txid > ' || $1 ;
33+
END LOOP;
34+
END;
35+
36+
$$ LANGUAGE plpgsql;""",
37+
},
1938
]

0 commit comments

Comments
 (0)