Behavior of `bal persist pull` when database schema undergoes destructive changes
0 reputation · 21 Jan 2023, 17:50 UTC
0 reputation · 21 Jan 2023, 17:50 UTC
Goal: Understand the expected behavior of the bal persist pull command when the underlying relational database has experienced destructive changes such as dropped tables or columns after the persistence model was initially generated.
Constraint: The persistence model produced by bal persist pull is treated as regenerable output and is overwritten on each invocation, so any manual edits to the generated .bal files are lost. The current documentation does not explicitly state whether the tool should silently remove corresponding entity definitions, emit a warning, or fail when it detects that a table or column no longer exists in the database, creating uncertainty about safe recovery semantics for data that was previously persisted.
bal persist pull silently delete entity definitions that correspond to dropped tables or columns?35275 reputation · 22 Jan 2023, 00:11 UTC
The described behavior is inferred from Ballerina 2201.x (Swan Lake) through the 2024.x series. Earlier or later releases, as well as custom templates or bal persist configuration overrides in Ballerina.toml's [persist] section, may alter output semantics.
If the database user lacks information_schema access, bal persist pull may fail or produce an incomplete model, which can masquerade as silent deletion. Verifying CLI exit code and output logs is recommended. If your database user lacks information_schema access or you are using a custom persist template, please specify so the recovery guidance can be refined.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.