Performance: Database folder and migrations
MEDIUM IMPACT
This concept affects the initial page load speed and backend response time by managing how database schema changes are applied and how the app interacts with the database.
class AddDetailsToUsers < ActiveRecord::Migration[6.0] def change add_column :users, :details, :string end end
class AddDetailsToUsers < ActiveRecord::Migration[6.0] def change add_column :users, :details, :text add_column :users, :details, :string end end
| Pattern | Database Locks | Migration Time | Backend Delay | Verdict |
|---|---|---|---|---|
| Redundant migrations with conflicting changes | High - multiple locks | Long - repeated schema updates | High - blocks server response | [X] Bad |
| Single clear migration per change | Low - minimal locking | Short - one schema update | Low - faster server response | [OK] Good |