Skip to content

D84 · v1's rate-change audit and contract columns are kept as legacy_ columns on rentals and contracts, not as a table

Proposed · 2026-10-30 · zuki accepted the recommendation on #302 ("I accept your recommendations"); it binds when this page's pull request is merged

Decision: The rentals step carries the v1 columns it used to leave unread, without adding a table:

  • rentals.legacy_data jsonb holds, for each chain row that begins at a v1 fee change (R-RNT-41), that audit row's oleh, detail, plat_before and plat_after.
  • contracts.legacy_updated_at timestamptz holds v1's contracts.updated_at. v2's own updated_at is set by v2 and is not overwritten.
  • Every column that carries v1-only data is named legacy_…. It is written by the migration and read by nobody in v2; a later migration may drop it when zuki says so.
  • contracts.nama and v_rental_fee_audit.nama are not carried. Both are the driver's name, which v2 holds in drivers, and neither is published (D15). zuki signs them as ignored in migration.accepted_differences (R-MIG-06) when he signs the report.
  • A change the chain does not carry is ignored on purpose and counted, not stored: the plate-only changes (253 of the 877 rows on the copy of 2026-10-29), several changes on one day merged to the day's last rate (R-RNT-59), the changes dated before the handover, and the 33 rows from activity_log (R-RNT-43). The reconcile prints each count, and they add up to the rows of v_rental_fee_audit.

Why:

  • zuki, 2026-10-30, on #302: the audit columns "are kinda necessary", the audit log starts anew, so the data belongs on rentals "without adding new table"; the contract's updated_at matters because v1 edits the current contract in place; "claim it all except contracts.nama, and then if the current v2 don't really need them add suffix legacy_"; "drop both nama columns, ignore the dropped changes".
  • D18 asks for zero unexplained rows. Columns on rentals can hold only the changes the chain carries, so the others are counted as ignored on purpose, as R-RNT-43 already does for activity_log.
  • inspections.legacy_data (20261006000700_operations.sql) is the same pattern: v1's original, read-only, in one jsonb column, so a later migration drops one column and not six.
  • D75: v1 is still developing, and the reconcile lists what no step reads (R-MIG-10) until a step claims it or zuki signs it. This decision claims six of the eight columns and signs two.

Consequences:

  • The rules (DOC): R-RNT-43 stops saying the audit is not carried; it says v2's audit log starts at cutover and v1's rate-change audit is kept as legacy_data. New R-RNT IDs follow R-RNT-67 for the two columns, the counted drops and the two signed nama columns.
  • The schema and the step (BE): rentals.legacy_data and contracts.legacy_updated_at, edited in place (D11); the step reads v_rental_fee_audit and contracts.updated_at; the checks stop listing the claimed columns as unclaimed and print a count for the dropped changes; app roles cannot write a legacy_ column. Tests first (D27).
  • BE-DP-36's expects change for v1 unclaimed (7 lines become 2, the two nama columns, until zuki signs them).
  • v2's audit log still starts at cutover (build/cutover.md, step 2). legacy_data is v1 data, not an audit entry.
  • Unchanged: the chain's rules (R-RNT-41, R-RNT-42, R-RNT-59), migration.contract_terms (D11), and the activity_log rows ignored on purpose.
  • Is an amended contract a new row in v2? v1 edits the current contract in place, which zuki calls wrong. That is a rule for the contracts module, not this decision; it goes to DOC as a question the next time the contracts page is touched.