A database waits for its next migration. You open the schema file. One task: add a new column. It seems simple. It is not.
Adding a new column touches code, data, and performance. In production, even a small schema change can block queries, lock tables, or break downstream services. The goal is precision: define the column, migrate without downtime, and deploy without risk.
Plan the change before you type ALTER TABLE. Choose the right data type. Set defaults carefully. Avoid NOT NULL without a safe default, or you will block writes. If you need indexed access, add the index in a separate step to reduce load.
For large datasets, consider online schema change tools like pt-online-schema-change or gh-ost. These let you add a new column without locking the main table. Test these migrations against a realistic staging copy of your data. Watch for replication lag and review query plans.