Bump room to 2.6.0 and rename paramter to match super class in case of use of names paramters

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2023-10-19 10:53:44 +02:00
parent 0fa6e70dd7
commit 357b580a84
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
2 changed files with 21 additions and 21 deletions

View File

@ -149,7 +149,7 @@ ext {
parcelerVersion = "1.1.13" parcelerVersion = "1.1.13"
prismVersion = "2.0.0" prismVersion = "2.0.0"
retrofit2Version = "2.9.0" retrofit2Version = "2.9.0"
roomVersion = "2.5.2" roomVersion = "2.6.0"
workVersion = "2.8.1" workVersion = "2.8.1"
espressoVersion = "3.5.1" espressoVersion = "3.5.1"
media3_version = "1.1.1" media3_version = "1.1.1"

View File

@ -27,28 +27,28 @@ import androidx.sqlite.db.SupportSQLiteDatabase
@Suppress("MagicNumber") @Suppress("MagicNumber")
object Migrations { object Migrations {
val MIGRATION_6_8 = object : Migration(6, 8) { val MIGRATION_6_8 = object : Migration(6, 8) {
override fun migrate(database: SupportSQLiteDatabase) { override fun migrate(db: SupportSQLiteDatabase) {
Log.i("Migrations", "Migrating 6 to 8") Log.i("Migrations", "Migrating 6 to 8")
migrateToRoom(database) migrateToRoom(db)
} }
} }
val MIGRATION_7_8 = object : Migration(7, 8) { val MIGRATION_7_8 = object : Migration(7, 8) {
override fun migrate(database: SupportSQLiteDatabase) { override fun migrate(db: SupportSQLiteDatabase) {
Log.i("Migrations", "Migrating 7 to 8") Log.i("Migrations", "Migrating 7 to 8")
migrateToRoom(database) migrateToRoom(db)
} }
} }
val MIGRATION_8_9 = object : Migration(8, 9) { val MIGRATION_8_9 = object : Migration(8, 9) {
override fun migrate(database: SupportSQLiteDatabase) { override fun migrate(db: SupportSQLiteDatabase) {
Log.i("Migrations", "Migrating 8 to 9") Log.i("Migrations", "Migrating 8 to 9")
migrateToDualPrimaryKeyArbitraryStorage(database) migrateToDualPrimaryKeyArbitraryStorage(db)
} }
} }
fun migrateToRoom(database: SupportSQLiteDatabase) { fun migrateToRoom(db: SupportSQLiteDatabase) {
database.execSQL( db.execSQL(
"CREATE TABLE User_new (" + "CREATE TABLE User_new (" +
"id INTEGER NOT NULL, " + "id INTEGER NOT NULL, " +
"userId TEXT, " + "userId TEXT, " +
@ -65,7 +65,7 @@ object Migrations {
"PRIMARY KEY(id)" + "PRIMARY KEY(id)" +
")" ")"
) )
database.execSQL( db.execSQL(
"CREATE TABLE ArbitraryStorage_new (" + "CREATE TABLE ArbitraryStorage_new (" +
"accountIdentifier INTEGER NOT NULL, " + "accountIdentifier INTEGER NOT NULL, " +
"\"key\" TEXT, " + "\"key\" TEXT, " +
@ -75,7 +75,7 @@ object Migrations {
")" ")"
) )
// Copy the data // Copy the data
database.execSQL( db.execSQL(
"INSERT INTO User_new (" + "INSERT INTO User_new (" +
"id, userId, username, baseUrl, token, displayName, pushConfigurationState, capabilities, " + "id, userId, username, baseUrl, token, displayName, pushConfigurationState, capabilities, " +
"clientCertificate, externalSignalingServer, current, scheduledForDeletion) " + "clientCertificate, externalSignalingServer, current, scheduledForDeletion) " +
@ -84,7 +84,7 @@ object Migrations {
"clientCertificate, externalSignalingServer, current, scheduledForDeletion " + "clientCertificate, externalSignalingServer, current, scheduledForDeletion " +
"FROM User" "FROM User"
) )
database.execSQL( db.execSQL(
"INSERT INTO ArbitraryStorage_new (" + "INSERT INTO ArbitraryStorage_new (" +
"accountIdentifier, \"key\", object, value) " + "accountIdentifier, \"key\", object, value) " +
"SELECT " + "SELECT " +
@ -92,16 +92,16 @@ object Migrations {
"FROM ArbitraryStorage" "FROM ArbitraryStorage"
) )
// Remove the old table // Remove the old table
database.execSQL("DROP TABLE User") db.execSQL("DROP TABLE User")
database.execSQL("DROP TABLE ArbitraryStorage") db.execSQL("DROP TABLE ArbitraryStorage")
// Change the table name to the correct one // Change the table name to the correct one
database.execSQL("ALTER TABLE User_new RENAME TO User") db.execSQL("ALTER TABLE User_new RENAME TO User")
database.execSQL("ALTER TABLE ArbitraryStorage_new RENAME TO ArbitraryStorage") db.execSQL("ALTER TABLE ArbitraryStorage_new RENAME TO ArbitraryStorage")
} }
fun migrateToDualPrimaryKeyArbitraryStorage(database: SupportSQLiteDatabase) { fun migrateToDualPrimaryKeyArbitraryStorage(db: SupportSQLiteDatabase) {
database.execSQL( db.execSQL(
"CREATE TABLE ArbitraryStorage_dualPK (" + "CREATE TABLE ArbitraryStorage_dualPK (" +
"accountIdentifier INTEGER NOT NULL, " + "accountIdentifier INTEGER NOT NULL, " +
"\"key\" TEXT NOT NULL, " + "\"key\" TEXT NOT NULL, " +
@ -111,7 +111,7 @@ object Migrations {
")" ")"
) )
// Copy the data // Copy the data
database.execSQL( db.execSQL(
"INSERT INTO ArbitraryStorage_dualPK (" + "INSERT INTO ArbitraryStorage_dualPK (" +
"accountIdentifier, \"key\", object, value) " + "accountIdentifier, \"key\", object, value) " +
"SELECT " + "SELECT " +
@ -119,9 +119,9 @@ object Migrations {
"FROM ArbitraryStorage" "FROM ArbitraryStorage"
) )
// Remove the old table // Remove the old table
database.execSQL("DROP TABLE ArbitraryStorage") db.execSQL("DROP TABLE ArbitraryStorage")
// Change the table name to the correct one // Change the table name to the correct one
database.execSQL("ALTER TABLE ArbitraryStorage_dualPK RENAME TO ArbitraryStorage") db.execSQL("ALTER TABLE ArbitraryStorage_dualPK RENAME TO ArbitraryStorage")
} }
} }