Safe-write sandbox

Made-up data

A made-up table of tutors, a table of bookings that links to it, and a source to copy new rows from. Pick rows to put in a batch. Nothing is written until you approve it; then every written row is read back and the count is checked. Deleting is never allowed: try it.

Staging, approving and undoing need JavaScript. Without it, the sample batch reads below, staged but not written. A delete never runs: it is flagged, and the row gets a last seen date instead.

The table

Tutors: 6 rows
NameTeachesSign-inStatus
FennWorld historyfenn10In the source
AdaFrenchada79In the source
BramWorld historybram31In the source
DaraFrenchdara81In the source
HollisGeometryhollis59In the source
CleoSpanishcleo52In the source

The source

The full download says it holds 9 rows, and 9 arrived. 4 of them are not in the table as written:

  • "Esme"Physicstabesme10
  • "Kit"Geometrykit71
  • "Noor"Frenchnoor83
  • "bram "World historybram31

Mark rows gone that a download no longer holds

Batch 1

Staged, nothing written
  • New row: Kit, Geometry, sign-in kit71
  • New row: Noor, French, sign-in noor83
  • Last seen 12 May: Fenn. Asked to delete. Kept, with a last seen date.

Held or flagged

  • Held: "Esme". Sign-in "tabesme10". The sign-in name starts with an invisible tab character, shown here in words. It would never match the same sign-in name typed by hand.
  • Held: "bram ". Already in the table as Bram. Only case and spaces differ.
  • Delete Fenn. Not deleted. The booking on Wednesday 3 pm links to this row and would break. Staged as last seen 12 May instead.
  • Incomplete download. The download says it holds 9 rows, and 7 arrived. Nothing is marked gone until the source is complete. Had it run, it would have marked 2 rows gone, 1 of them still in the source.

The checks, one per rule

  1. Look. Flagged. Counted 6 rows. Checked 4 new rows against the table. Saved a copy of the 1 row that will change. Held 2 rows back.
  2. Never delete. Flagged. 1 delete asked for. No row was removed.
  3. Source complete. Flagged. The download is incomplete, so nothing is marked gone.
  4. Stage. Passed. Batch 1: 2 new rows, 1 change. Nothing written yet.
  5. Approve. Waiting. Waits for a person who has seen every change.
  6. Write. Waiting. Nothing written yet.
  7. Read back. Waiting. Each written row will be read back.
  8. Count. Waiting. The count before plus the new rows must equal the count after.

On record

No batch written yet.