The code halted. The data didn’t make sense. The fix was simple: a new column.
In databases, adding a new column is more than altering a table. It changes the schema, updates dependencies, and transforms how your application reads and writes data. Whether you use PostgreSQL, MySQL, or SQLite, the process follows a strict set of steps—if you ignore them, you risk downtime or silent data corruption.
A new column starts at the schema layer. You define the column name, data type, nullability, and default value. For example:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
Once the migration runs, your application must know how to handle it. ORM models need updates. Validation rules must match the new constraints. APIs that return user data might expose the new column, so you adjust serializers or DTOs.