The database waits, but the migration clock is ticking. You need a new column, and you need it without breaking production.
Adding a new column should be fast, but it should also be safe. Whether you are on PostgreSQL, MySQL, or another relational database, the wrong approach can lock tables, slow queries, or take your system offline. The right approach keeps your service live while schema changes roll out.
Start by defining the new column with a clear name and type. Avoid vague naming—future you will thank you. Specify NULL or NOT NULL based on data needs, but remember that adding a NOT NULL column with no default in a large table can lock writes. Use defaults for backward compatibility, and execute the change in small, tested steps.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is straightforward, but consider using ADD COLUMN with a default in two phases: first add as nullable, then backfill data, then enforce constraints. In MySQL, online DDL options like ALGORITHM=INPLACE or LOCK=NONE reduce downtime. Always run schema changes in staging with production-like load before touching real data.