The database cracked open under the weight of new data. You need a new column, and you need it without breaking production.
Adding a new column should be fast, safe, and traceable. Done wrong, it locks tables, slows queries, and invites downtime. Done right, it keeps your schema agile while your application keeps serving traffic.
First, decide on the column name and data type. Keep naming consistent with existing conventions. Choose the smallest data type that fits the data—it improves performance and reduces storage costs.
Second, add the column with a migration tool or database migration script. For large tables, use an online schema change method to avoid blocking writes. In MySQL, tools like gh-ost or pt-online-schema-change can handle live migrations. PostgreSQL often supports adding nullable columns instantly, but adding defaults on large datasets may still lock the table.