Skip to content

BE-DP-05 · Dump v1's public schema through v2_reader

ID BE-DP-05 · Level L0, for good: it reads v1 production · Pack Pack R1 · The v1 copy · Run order row 1, first · Issue #184

../opleet-private/v1_public.dump on your Mac holds v1's public schema and every row in it, read through v2_reader, the read-only login from TL-DP-01. The folder is readable by you alone. Nothing is written to v1, and nothing here uses an admin password.

The dump is personal data: NIK, phones, addresses and photos' links (D15). It never enters the repository, an issue, a pull request or a chat. Only counts leave your Mac.

  • Row 8 is done: v2_reader exists on v1 (#183), and <V1_READONLY_PASSWORD> is in your password manager.
  • Docker Desktop is running. Your Mac has no pg_dump (BE-M0-01), so it runs from Docker's postgres:17 image, the same major version as v1 (17.6).
  • About 10 minutes and a few hundred MB free in your home folder.

1 · A private folder for the dump, outside the repository

Section titled “1 · A private folder for the dump, outside the repository”

The folder is opleet-private, next to your clone, so ../opleet-private from the repository root. Every command in the data phase runs from that root and names the folder that way.

Terminal window
mkdir -p ../opleet-private
chmod 700 ../opleet-private

pg_dump asks for the password at its prompt: paste <V1_READONLY_PASSWORD> from your password manager. It never goes in the command.

Terminal window
docker run --rm -it -v "$PWD/../opleet-private":/out postgres:17 pg_dump "host=aws-1-ap-southeast-1.pooler.supabase.com port=5432 dbname=postgres user=v2_reader.iftobibewckspysjsxnm sslmode=require" --password --schema=public --no-owner --no-privileges --no-publications --no-subscriptions -Fc -f /out/v1_public.dump

3 · Only you can read it, and what it holds

Section titled “3 · Only you can read it, and what it holds”
Terminal window
chmod 600 ../opleet-private/v1_public.dump
ls -l ../opleet-private
docker run --rm -v "$PWD/../opleet-private":/in:ro postgres:17 sh -c 'pg_restore -l /in/v1_public.dump | grep -c " TABLE DATA public "'
  • Block 1 prints nothing.
  • Block 2: Password:, then nothing for a few minutes, then the prompt returns. The first run also pulls the postgres:17 image. A line starting pg_dump: warning: about a table's dependencies is fine to note; pg_dump: error: is not (see below).
  • Block 3: -rw------- before v1_public.dump, with a size in MB, then one number: how many of v1's tables have data in the dump. Note it for BE-DP-06.
Terminal window
docker run --rm -v "$PWD/../opleet-private":/in:ro postgres:17 sh -c 'pg_restore -l /in/v1_public.dump | head -12'

The header names Dumped from database version: 17.6, Format: CUSTOM and the postgres database. It lists counts and versions only, no rows.

  • password authentication failed for user "v2_reader": the password doesn't match. Check you copied the whole entry, with no space, and run block 2 again. After two failures, stop and tell the CTO on #183; never reset it to something new here.
  • query would be affected by row-level security policy: v2_reader has lost bypassrls. Stop and post the line on #184; TL-DP-01's Check shows the role.
  • too many connections or remaining connection slots are reserved: v2_reader allows three. Close any other session using it and run block 2 again.
  • server version: 17.x; pg_dump version: 16.x or older: Docker gave you an old image. Run docker pull postgres:17 and block 2 again.
  • Tenant or user not found: the user name lost its .iftobibewckspysjsxnm part. Copy block 2 again as it is.
  • Anything else: post the pg_dump: error: line on #184. It names a table or a setting, never a row.
Terminal window
rm ../opleet-private/v1_public.dump

Nothing was written to v1. Delete the dump when the data phase no longer needs it, and in any case before cutover (D15).

Log each run as a comment on #184: the date, the size from block 3 and its table count. Never a row, a name or a link.