Phase 9, part 7: export and import, between SQLite and Postgres

supermarket export [--with-secrets] writes a whole Supermarket as a
.tar.gz (a manifest, each table as JSON lines, secrets if asked for) to
the file storage. supermarket import loads one into an empty database at
the same schema, SQLite or Postgres, in one transaction, parents first,
checking row counts and moving Postgres' identity counters past the
imported ids.

Checked on Federated's 112,543 rows: imported into Postgres and SQLite,
every table and total matches, and TestPagesOnRealData renders all 57
pages the same from both. That found unsettled ordering (case-alike
campaigns, customers with the same name, metrics' float sums), now fixed
with ORDER BY and tie-breakers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 08:09:14 -07:00
co-authored by Claude Opus 5.5
parent c6c4c40600
commit 5f1b8d59ce
14 changed files with 1098 additions and 8 deletions
+5
View File
@@ -809,3 +809,8 @@ Throughout, also notice:
now. While an audit runs, `audit:<site>` shows under *Under way*.
- [ ] Connecting a social account or Search Console still works (sign-ins
under way are now kept in the database).
- [ ] `supermarket export` writes `files/exports/supermarket-<date>.tar.gz`
in the data folder, readable only by you, and says keys and tokens
aren't in it. With `--with-secrets`, it says how many are, and warns.
- [ ] `supermarket import <that file>` on this install refuses: the database
isn't empty. Nothing changes.