Strict column mapping vs loose column mapping: Choosing the right mode after schema changes
0 reputation · 23 Dec 2023, 12:55 UTC
Goal
To keep a DataTables instance functional when a database schema is rolled out or rolled back, the front‑end must adapt its column mapping without breaking the user interface.
Constraints
DataTables relies on the columns array to map server JSON keys. In server‑side mode the plugin sends column metadata to the back‑end and expects a matching response. There is no built‑in toggle for forgiving missing or renamed keys.
Uncertainty
Should the application enforce a strict mapping that fails fast when a column is missing, or should it adopt a loose approach that silently ignores absent columns and uses columnDefs to hide them? The library offers no explicit flag to switch between these behaviors.
Questions
- When a schema change removes a column, does strict mapping provide a clearer error signal than a loose mapping that simply hides the missing data?
- Can
columnDefsbe leveraged to maintain backward compatibility while the server updates its query logic? - What pattern can be used to expose a feature flag that serves the legacy
columnsarray to the front‑end during a rollback?