mirror of
https://github.com/torlando-tech/columba.git
synced 2025-12-22 05:37:07 +00:00
fix: add migration to remove legacy AutoInterface ports
MIGRATION_3_4 removes hardcoded discovery_port (48555) and data_port (49555) from AutoInterface configs. These were from early development and should be null to let RNS use proper defaults (29716/42671). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import javax.inject.Provider
|
||||
*/
|
||||
@Database(
|
||||
entities = [InterfaceEntity::class],
|
||||
version = 3,
|
||||
version = 4,
|
||||
exportSchema = true,
|
||||
)
|
||||
abstract class InterfaceDatabase : RoomDatabase() {
|
||||
@@ -103,6 +103,31 @@ abstract class InterfaceDatabase : RoomDatabase() {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migration from version 3 to version 4.
|
||||
* Removes legacy discovery_port (48555) and data_port (49555) from AutoInterface configs.
|
||||
* These ports were from early development; removing them lets RNS use proper defaults.
|
||||
*/
|
||||
val MIGRATION_3_4 =
|
||||
object : Migration(3, 4) {
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
// Remove legacy port settings from AutoInterface entries
|
||||
// The ports were added during development and should be null to use RNS defaults
|
||||
// Uses string REPLACE since SQLite JSON functions require API 34+
|
||||
db.execSQL(
|
||||
"""
|
||||
UPDATE interfaces
|
||||
SET configJson = REPLACE(REPLACE(configJson,
|
||||
',"discovery_port":48555', ''),
|
||||
',"data_port":49555', '')
|
||||
WHERE type = 'AutoInterface'
|
||||
AND configJson LIKE '%"discovery_port":48555%'
|
||||
AND configJson LIKE '%"data_port":49555%'
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ object InterfaceDatabaseModule {
|
||||
"interface_database",
|
||||
)
|
||||
.addCallback(InterfaceDatabase.Callback(context, database, applicationScope))
|
||||
.addMigrations(InterfaceDatabase.MIGRATION_1_2, InterfaceDatabase.MIGRATION_2_3)
|
||||
.addMigrations(InterfaceDatabase.MIGRATION_1_2, InterfaceDatabase.MIGRATION_2_3, InterfaceDatabase.MIGRATION_3_4)
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user