Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.25

- Fix drop_before_all test fixture to properly exclude history tables using regex pattern

## 0.1.24

- Fix build
Expand Down
2 changes: 1 addition & 1 deletion aidbox_python_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = "aidbox-python-sdk"
__version__ = "0.1.24"
__version__ = "0.1.25"
__author__ = "beda.software"
__license__ = "None"
__copyright__ = "Copyright 2024 beda.software"
Expand Down
20 changes: 20 additions & 0 deletions aidbox_python_sdk/db_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@
"sql": """
DROP FUNCTION IF EXISTS drop_before_all(integer);

CREATE FUNCTION drop_before_all(integer) RETURNS VOID AS $$
declare
e record;
BEGIN
FOR e IN (
SELECT table_name
FROM information_schema.columns
WHERE column_name = 'txid' AND table_schema = 'public' AND table_name NOT LIKE '%_history'
) LOOP
EXECUTE 'DELETE FROM "' || e.table_name || '" WHERE txid > ' || $1 ;
END LOOP;
END;

$$ LANGUAGE plpgsql;""",
},
{
"id": "20251209_fix_drop_before_all_history",
"sql": """
DROP FUNCTION IF EXISTS drop_before_all(integer);

CREATE FUNCTION drop_before_all(integer) RETURNS VOID AS $$
declare
e record;
Expand Down
Loading