Database Reset & Reinstall
Full wipe-and-recreate of the Cloud Spanner schema and seed data.
All scripts are dry-run by default — add --apply to execute.
Prerequisites
gcloudinstalled and authenticated (gcloud auth login)- Access to the target GCP project/Spanner instance/database
jqinstalled
Step 1: Drop all tables
# Dry-run (lists tables that would be dropped)
infra/scripts/drop-all-spanner-tables.sh \
--project pinpoint-payments \
--instance pinpointpos-spanner \
--database pinpointpos
# Apply (destructive; requires typing a random confirmation string)
infra/scripts/drop-all-spanner-tables.sh \
--project pinpoint-payments \
--instance pinpointpos-spanner \
--database pinpointpos \
--apply
Step 2: Apply schema from SQLDelight .sq files
The master schema is defined in SQLDelight .sq files under
apps/specifications/schema/src/main/sqldelight/com/myriad/schema/.
The script extracts CREATE TABLE and CREATE INDEX statements from all .sq
files, topologically sorts them by FK dependencies, and applies the DDL.
# Dry-run (shows parsed DDL, table order, and statement counts)
infra/scripts/apply-init-sql.sh \
--project pinpoint-payments \
--instance pinpointpos-spanner \
--database pinpointpos
# Apply
infra/scripts/apply-init-sql.sh \
--project pinpoint-payments \
--instance pinpointpos-spanner \
--database pinpointpos \
--apply
Step 3 (optional): Bootstrap first superuser
infra/scripts/bootstrap-first-superuser.sh \
--project pinpoint-payments \
--instance pinpointpos-spanner \
--database pinpointpos \
--email you@company.com \
--first-name Your \
--last-name Name \
--firebase-id your-firebase-uid