Adding a new column changes the shape of your dataset. It’s more than a field; it’s a decision point. In SQL, the command is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This is fast if your table is small. For large tables in production, performance matters. Adding a column can lock the table. Plan for downtime or run migrations in stages. Use NULL as a default when possible to avoid rewriting every row.
In PostgreSQL, new columns with a default value can be added without rewriting the entire table from version 11 onward. In MySQL, defaults behave differently, and older versions may require a full table rebuild. Always check your database documentation before executing changes.
If you use ORMs like Sequelize or Prisma, adding a column involves updating the model and running a migration script. Keep schema definitions in sync across environments. Test in staging before prod.