Skip to content

Data migration — def-exsport-data-migration

A one-off Deno CLI that reads Google Sheets and imports the rows into the Exsport Postgres database. It is an operational tool, not a service.

How this page was verified

Read on 2026-09-15 from main.ts, deno.json and the helper files. Local checkout: /Volumes/xpro/erisristemena/deno/def-exsport-data-migration.

Stack

Deno / TypeScript. Imports (deno.json): postgres (deno.land 0.17), @std/dotenv, nanoid (npm), @std/assert. Entry main.ts, helpers database.ts, exsport.ts, wms.ts. Tasks: dev = deno run --watch --allow-net --allow-read --allow-write --allow-env main.ts; start = same without --watch. Single-branch: main only.

What it does

It authenticates to Google (Drive + Sheets read-only; credentials.jsontoken.json), reads the source spreadsheet, and writes into Postgres. Flags:

  • --auth, --list, --search — set up and inspect.
  • --migrate — products and articles from the Product / Article sheets.
  • --migrate-members, and dated runs --migrate-members-251130, --migrate-members-260628 — read Store + Profile Member sheets.
  • --fix-missing-shortcodes — a stub.

Postgres connection from POSTGRES_HOST/PORT/DATABASE/USER/PASSWORD; spreadsheet from GOOGLE_SPREADSHEET_ID / GOOGLE_SHEET_NAME. The repo also carries member source data as committed CSV/XLSX files (existing_members_batch_*).

Run it deliberately, against the database .env names a snapshot, not production, unless the task is a real migration.