Skip to content

BE-DP-20 · The shapes of v1's other tables, for the domain steps

ID BE-DP-20 · Level L0 · Pack Row 5 · The domain steps · Run order row 5, first, before any domain step is written · Issues #279, #280, #281, #262

The columns, jsonb paths and enum values of every v1 table a domain step or the photo copy reads are on that step's issue, so each migration.step_<name>() is written against v1's real shape, as the money study was after BE-DP-11.

BE-DP-08 counted v1's 34 tables, and BE-DP-11 printed the shapes of the money tables and onboarding. Nothing records the others' layout: vehicle_master keeps its plate in data ->> 'plat' (#184), and most tables keep their fields in jsonb the same way. tools/migration/v1-copy/shapes.sql is BE-DP-11's script for the tables you name, with two additions: the form of each text column's values, and enum-like names for drivers and cars (role, gender, education, brand, model, transmission, colour and similar).

Three runs, one per group of steps:

Block Tables For
1 vehicle_master, v_vehicle_master, vehicle_status, vehicle_status_log, app_settings the vehicles step (#280) and the master_data step (#279)
2 leads, deleted_leads, bc, antrian, v_driver_profile the drivers step (#281)
3 checkpoints, asuransi_claims, etle, gate_logs, maintenance, work_orders, preparation, exit_tickets, handovers, stock_opname_expected, stock_opname_sessions the operations step and the photo copy (#262), which attaches files to these rows

The access step (#278) reads v1's logins live through v2_export (TL-DP-02), not the copy, so it isn't here. activity_log (69,097 rows) is left out until a step needs it.

It prints names of columns and keys, counts, forms and enum values only, never a name, phone, plate, NIK or any other value from a row (D15). It reads the copy and changes nothing in it.

  • Pack R1 is done: the copy runs as v1copy (BE-DP-06), and docker ps --filter name=v1copy lists it as Up.
  • You are at the root of your clone, on main once this step's pull request is merged.
Terminal window
docker exec -i v1copy psql -qX -U postgres -d postgres -v tables=vehicle_master,v_vehicle_master,vehicle_status,vehicle_status_log,app_settings < tools/migration/v1-copy/shapes.sql > ../opleet-private/shapes-1.txt
Terminal window
docker exec -i v1copy psql -qX -U postgres -d postgres -v tables=leads,deleted_leads,bc,antrian,v_driver_profile < tools/migration/v1-copy/shapes.sql > ../opleet-private/shapes-2.txt
Terminal window
docker exec -i v1copy psql -qX -U postgres -d postgres -v tables=checkpoints,asuransi_claims,etle,gate_logs,maintenance,work_orders,preparation,exit_tickets,handovers,stock_opname_expected,stock_opname_sessions < tools/migration/v1-copy/shapes.sql > ../opleet-private/shapes-3.txt

Each file has four sections:

  • 0 · Names asked for that the copy doesn't have: empty. A view such as v_vehicle_master listed here only means v1 has no view by that name; say so when you post.
  • 1 · Columns of each table, with filled, rows and, for text, string_form.
  • 2 · Paths inside their jsonb columns. Several hundred lines for block 3 is normal.
  • 3 · Values of enum-like keys.

Read section 3's value column in each file before posting. It lists only keys whose names say status, role, type, brand and the like, with at most 15 values each. If a value still reads like a person's name, a phone, a plate or a number from a document, delete that line and say you did.

Then post each file on its issues, as printed: block 1 on #280 and #279, block 2 on #281, block 3 on #262. If a file is too long for one comment, post it a section per comment.

  • Name the tables: the -v tables= part was lost when copying. Copy the block again.
  • ERROR: post the line on the block's issue. It names a table, a column or a path, never a value.
  • It runs for more than ten minutes: let it finish. If it seems stuck, docker exec v1copy psql -U postgres -c "select now() - query_start, left(query, 60) from pg_stat_activity where state = 'active'" shows how long it has run.

Nothing to undo in the copy: it reads only, and its tables are temporary. The three files hold only names, counts, forms and enum values; delete them with the dump at the end of the data phase (BE-DP-08's Undo).

Log each block as a comment on its issues: date · who · result, with the file's sections.