# Room ALTER TABLE ADD COLUMN Migration Pattern

When adding new columns to existing Room entities, use `ALTER TABLE ADD COLUMN` with `DEFAULT` values for NOT NULL columns.

## Template

```kotlin
// 1. Bump version in @Database annotation
@Database(entities = [...], version = 8, ...)

// 2. Add migration companion object in the database class
val MIGRATION_7_8: Migration = object : Migration(7, 8) {
    override fun migrate(db: SupportSQLiteDatabase) {
        // NOT NULL columns need DEFAULT
        db.execSQL("ALTER TABLE `addons` ADD COLUMN `newField` TEXT NOT NULL DEFAULT ''")
        db.execSQL("ALTER TABLE `addons` ADD COLUMN `anotherField` INTEGER NOT NULL DEFAULT 0")
        // Nullable columns don't need DEFAULT
        db.execSQL("ALTER TABLE `addons` ADD COLUMN `nullableField` TEXT")
    }
}

// 3. Register in the database builder
Room.databaseBuilder(context, MyDatabase::class.java, "db_name")
    .addMigrations(MyDatabase.MIGRATION_7_8)
    .build()
```

## Rules

- One `ALTER TABLE` per column — SQLite doesn't support multi-column ALTER
- NOT NULL columns MUST include `DEFAULT <value>` — existing rows get filled with it
- Nullable columns do NOT need DEFAULT — existing rows get `NULL`
- Column names and types must match the Room entity exactly
- Register ALL migration steps — missing one crashes on that schema version
- Do NOT use `fallbackToDestructiveMigration()` — wipes user data
- Commit generated schema JSON at `app/schemas/<database>/<version>.json`
