PR #9706 review: environments.machine_size migration

Summary

Adds a nullable environments.machine_size text column: the machine size a workspace boots at when its create call names none. null (every existing row) means the organization's default. The PR has only the migration. The code that reads and writes the column comes in a stacked PR, as packages/trpc/AGENTS.md rule 10 asks.

Verdict

Looks good. It is a metadata-only ADD COLUMN on a small, cold table. The generated files match the schema, it applies cleanly with production lock settings, and CI is green.

Findings

Nothing blocking. One optional nit:

  1. Nit, packages/db/src/schema/schema.ts:828: machineSize is a plain text, so Drizzle infers string | null. The stacked PR must then narrow it with isMachineSize on every read. Optional fix: text("machine_size").$type<MachineSize>() (from @superset/shared/billing, which @superset/db already depends on). This changes no SQL. It is fine to skip this: v2_workspaces.machine_size (:987) and automations.machine_size (:1760) are untyped text as well, and a narrowed type can hide stale values after a size is removed from the offer.

Things I checked that are correct:

Evidence

Surface: DB migration only (no UI, CLI or API code changed). I applied it to this review workspace's own Neon branch (br-bold-heart…, endpoint ep-odd-leaf, a child of production). I did not use a shared or production database.

Table size on the production-child branch:

 environments | 176 kB | 226 rows

Schema drift check at the PR head:

$ bunx drizzle-kit generate --name=probe
No schema changes, nothing to migrate 😴

Apply with the production deploy settings:

$ PGOPTIONS="-c lock_timeout=5s -c statement_timeout=60s" bunx drizzle-kit migrate
[✓] migrations applied successfully!     (1.75 s wall clock, including the CLI start-up)
$ \d environments
 machine_size | text |  |  |
drizzle.__drizzle_migrations: 196 → 197 rows
environments: 230 rows, 0 with machine_size set (all null = org default)

I did not rehearse under load (pgbench). That matches the skill: the table is small and not hot.

Questions for the author

Test / CI notes

All at head 2b365bdee2a289212435e8180d477d0ddf293472: