The white cursor blinked in an empty migration file. The task was simple: add a new column. The danger was in the details.
A new column changes the shape of your data. It touches queries, indexes, constraints, and often your application code. Doing it fast is easy. Doing it without downtime, data loss, or hidden performance hits takes discipline.
Start by defining the column in a way that fits the schema and future growth. Choose the right data type. Match it to what the application will store, not what is convenient right now. Watch default values. A nullable column may seem safe, but it can hide missing data.
With relational databases, adding a new column to a large table can lock writes. This can block traffic. On platforms like PostgreSQL, adding a column without a default is fast. Adding one with a default rewrites the table. Plan the operation in two steps: create the column as null, then backfill data in batches, then add the default and constraints.