Skip to content

Conversation

@marcleblanc2
Copy link
Contributor

@marcleblanc2 marcleblanc2 commented Nov 3, 2025

The pgsql / frontend database already has too much confusion over its name when TS teams work with self-hosted customer admins. As far as I'm aware, the src snapshot databases commands for taking and uploading database snapshots as part of the migration from self-hosted to our Cloud is the only place our customers see the same database get a bonus third name primary, adding unnecessary confusion to a process which is already a little overwhelming for our customers, specifically the types of customers we're encouraging to migrate from self-hosted to Cloud.

I propose renaming primary -> pgsql in these src-cli commands, because that's the name of the pod / container which our self-hosted customer admins and TS teams already work with on a day-to-day basis, and it matches the database's name in the SG Cloud infra, and the rest of the commands throughout the migration process:

Customer commands:

# pgsql / frontend database is the only one that doesn't match from container name to snapshot name
docker exec -i pgsql sh -c 'PGPASSWORD=sg pg_dump ... --username=sg --dbname=sg' > src-snapshot/primary.sql

# codeintel and codeinsights get a snapshot name which match the container names
docker exec -i codeintel-db sh -c 'PGPASSWORD=sg pg_dump ... --username=sg --dbname=sg' > src-snapshot/codeintel.sql
docker exec -i codeinsights-db sh -c 'PGPASSWORD=password pg_dump ... --username=postgres --dbname=postgres' > src-snapshot/codeinsights.sql

IE commands:

DROP DATABASE IF EXISTS "pgsql";
CREATE DATABASE "pgsql";
gcloud sql import sql $CLOUD_SQL_INSTANCE  \
  gs://$BUCKET/primary.sql  \ # Confusing primary.sql
  --database=pgsql            # Database is named pgsql inside our Cloud instances

This database is referred to as frontend in database schema code, however, our self-hosted customer admins are never exposed to the database name frontend; it is the pgsql container that they work with / are taking the snapshot out of. The database name inside the container is also sg, but renaming the src-cli commands to sg wouldn't be any clearer.

Test plan

Naming change

@marcleblanc2 marcleblanc2 enabled auto-merge (squash) November 3, 2025 02:46
@marcleblanc2 marcleblanc2 force-pushed the marc-rename-primary-db-in-db-snapshot-commands branch from 6202e15 to 73b3a8a Compare November 3, 2025 15:53
Comment on lines +62 to +63
Output: filepath.Join(dir, "pgsql.sql"),
Target: targets.Pgsql,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a long time since I've been here, but are there any other process docs we need to update that may reference this DB by its old name?

@marcleblanc2 marcleblanc2 merged commit 153141a into main Nov 3, 2025
10 checks passed
@marcleblanc2 marcleblanc2 deleted the marc-rename-primary-db-in-db-snapshot-commands branch November 3, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants