android_catalogue1-10 Exercise 3: Designing the ISBN Feature ============================================================= Data model: add `val isbn: String? = null` to Item (optional, and only meaningful for Books). Room migration: raise @Database(version = 2) and add val MIGRATION_1_2 = object : Migration(1, 2) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL("ALTER TABLE item ADD COLUMN isbn TEXT") } } ... .addMigrations(MIGRATION_1_2) Existing rows get NULL. (Also set exportSchema's location and keep the version-1 schema file for tests.) Form: an optional "ISBN" field, shown only when the type is Book (extend labelsFor, or add a showIsbn flag), with a number-ish keyboard and a simple check digit validation as an extra. Detail screen: show the ISBN field when present (Field() already hides blanks). Backup: add `val isbn: String? = null` to BackupItem and raise BackupFile.CURRENT_VERSION to 2. Export writes it; import reads it and passes it to Item. Old backup (version 1) imported into the NEW app: works. There is no isbn key; the default null applies; the version check (1 <= 2) passes. New backup (version 2, with isbn keys) imported into the OLD app: the old app's require(file.version <= CURRENT_VERSION) rejects it with "made by a newer version of the app." Had that check not been there, ignoreUnknownKeys would have silently dropped the ISBNs, losing data without telling the user. Failing loudly is the safer behaviour, which is why the version field exists. Also decide: should countExact (the "already present" test) include the ISBN? Probably not: an item that gains an ISBN later is still the same item, so matching on title, creator, type and createdAt stays right.