Skip to content

Commit

Permalink
Fix database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
zaiatsartem committed Feb 4, 2025
1 parent 8bfb98e commit fc78bed
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase
val MIGRATION_10_11 = object : Migration(10, 11) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE `account_table` ADD COLUMN `is_active` INTEGER NOT NULL DEFAULT 0")
database.execSQL("ALTER TABLE `account_table` ADD COLUMN `icon_id` INTEGER NOT NULL DEFAULT 1")

database.execSQL("""
UPDATE `account_table`
SET `is_active` = 1
Expand All @@ -16,8 +18,6 @@ val MIGRATION_10_11 = object : Migration(10, 11) {
LIMIT 1
)
""")

database.execSQL("ALTER TABLE `account_table` ADD COLUMN `icon_id` INTEGER NOT NULL")
database.execSQL("""
UPDATE `account_table`
SET `icon_id` = (abs(random()) % 9) + 1
Expand Down

0 comments on commit fc78bed

Please sign in to comment.