The table loaded. But the schema was wrong. You needed a new column, fast.
Adding a new column in a production database should be deliberate. The schema defines how your data lives and moves. A careless change can lock tables, stall queries, or break applications. Doing it right means balancing speed with safety.
First, scope the change. Identify the exact name, data type, default value, and whether it can be NULL. Use explicit definitions to prevent unexpected behavior. Map how existing queries, ETL jobs, and API endpoints will interact with the new column.
Second, choose the method based on the database engine. In PostgreSQL, ALTER TABLE users ADD COLUMN signup_source TEXT; is straightforward. In MySQL, similar syntax applies, but watch for table locks. Large tables often require a migration strategy, adding the column without blocking writes. Tools like pt-online-schema-change handle this for high-traffic environments.