Performance: Adding and removing columns
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by changing database schema, which can impact server response time and frontend rendering if migrations block requests.
class AddBioToUsers < ActiveRecord::Migration[7.0] def change add_column :users, :bio, :text end end class RemoveNicknameFromUsers < ActiveRecord::Migration[7.0] def change remove_column :users, :nickname end end
class AddDetailsToUsers < ActiveRecord::Migration[7.0] def change add_column :users, :bio, :text remove_column :users, :nickname end end
| Pattern | Database Locking | Migration Duration | Page Load Impact | Verdict |
|---|---|---|---|---|
| Single migration with add and remove columns | Long table lock | Longer migration time | Blocks page load, increases LCP | [X] Bad |
| Separate migrations for add and remove columns | Shorter locks per migration | Shorter individual migrations | Improves server responsiveness, lowers LCP | [OK] Good |