Skip to content

Commit

Permalink
Update drop_before_all to support fhir-schema and old approach. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoder committed Sep 13, 2024
1 parent 63e9933 commit 188f6e6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.12

- Update drop_before_all to support fhir-schema and old approach #68

## 0.1.11

- Add `headers` to SDKOperationRequest
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.11"
__version__ = "0.1.12"
__author__ = "beda.software"
__license__ = "None"
__copyright__ = "Copyright 2024 beda.software"
Expand Down
25 changes: 22 additions & 3 deletions aidbox_python_sdk/db_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,26 @@
END LOOP;
END;
$$ LANGUAGE plpgsql;
""",
}
$$ LANGUAGE plpgsql;""",
},
{
"id": "20240913_change_drop_before_all",
"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;""",
},
]

0 comments on commit 188f6e6

Please sign in to comment.