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.
Before
Section titled “Before”- Row 8 is done:
v2_readerexists 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'spostgres:17image, 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.
mkdir -p ../opleet-privatechmod 700 ../opleet-private2 · The dump
Section titled “2 · The dump”pg_dump asks for the password at its prompt: paste <V1_READONLY_PASSWORD> from your password manager. It never goes in the command.
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.dump3 · Only you can read it, and what it holds
Section titled “3 · Only you can read it, and what it holds”chmod 600 ../opleet-private/v1_public.dumpls -l ../opleet-privatedocker run --rm -v "$PWD/../opleet-private":/in:ro postgres:17 sh -c 'pg_restore -l /in/v1_public.dump | grep -c " TABLE DATA public "'Expect
Section titled “Expect”- Block 1 prints nothing.
- Block 2:
Password:, then nothing for a few minutes, then the prompt returns. The first run also pulls thepostgres:17image. A line startingpg_dump: warning:about a table's dependencies is fine to note;pg_dump: error:is not (see below). - Block 3:
-rw-------beforev1_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.
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.
If it fails
Section titled “If it fails”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_readerhas lostbypassrls. Stop and post the line on #184; TL-DP-01's Check shows the role.too many connectionsorremaining connection slots are reserved:v2_readerallows three. Close any other session using it and run block 2 again.server version: 17.x; pg_dump version: 16.xor older: Docker gave you an old image. Rundocker pull postgres:17and block 2 again.Tenant or user not found: the user name lost its.iftobibewckspysjsxnmpart. 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.
rm ../opleet-private/v1_public.dumpNothing 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.