Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix DB migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Apr 24, 2022
1 parent 53c3c2f commit a2d48d3
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions app/src/main/java/com/ivy/wallet/io/persistence/IvyRoomDatabase.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.ivy.wallet.io.persistence

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import androidx.room.*
import androidx.room.migration.AutoMigrationSpec
import com.ivy.wallet.io.persistence.dao.*
import com.ivy.wallet.io.persistence.data.*
import com.ivy.wallet.io.persistence.migration.*
Expand All @@ -17,7 +15,14 @@ import com.ivy.wallet.io.persistence.migration.*
UserEntity::class, ExchangeRateEntity::class, BudgetEntity::class,
LoanEntity::class, LoanRecordEntity::class
],
version = 121,
autoMigrations = [
AutoMigration(
from = 121,
to = 122,
spec = IvyRoomDatabase.DeleteSEMigration::class
)
],
version = 122,
exportSchema = true
)
@TypeConverters(RoomTypeConverters::class)
Expand Down Expand Up @@ -84,4 +89,10 @@ abstract class IvyRoomDatabase : RoomDatabase() {
loanDao().deleteAll()
loanRecordDao().deleteAll()
}

@DeleteColumn(tableName = "accounts", columnName = "seAccountId")
@DeleteColumn(tableName = "transactions", columnName = "seTransactionId")
@DeleteColumn(tableName = "transactions", columnName = "seAutoCategoryId")
@DeleteColumn(tableName = "categories", columnName = "seCategoryName")
class DeleteSEMigration : AutoMigrationSpec
}

0 comments on commit a2d48d3

Please sign in to comment.