Skip to content

Commit

Permalink
Update migration number and make properties nullable in database
Browse files Browse the repository at this point in the history
  • Loading branch information
toupper committed Oct 2, 2023
1 parent 6d25ed9 commit d2cbed3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ data class OrderEntity(
val paymentUrl: String = "",
@ColumnInfo(name = "isEditable", defaultValue = "1")
val isEditable: Boolean = true,
@ColumnInfo(name = "needsPayment", defaultValue = "1")
val needsPayment: Boolean = true,
@ColumnInfo(name = "needsProcessing", defaultValue = "1")
val needsProcessing: Boolean = true
@ColumnInfo(name = "needsPayment")
val needsPayment: Boolean? = null,
@ColumnInfo(name = "needsProcessing")
val needsProcessing: Boolean? = null
) {
companion object {
private val gson by lazy { Gson() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class OrderDtoMapper @Inject internal constructor(
metaData = this.meta_data.toString(),
paymentUrl = this.payment_url ?: "",
isEditable = this.is_editable ?: (this.status in EDITABLE_STATUSES),
needsPayment = this.needs_payment ?: false,
needsProcessing = this.needs_processing ?: false,
needsPayment = this.needs_payment,
needsProcessing = this.needs_processing,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_20_21
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_21_22
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_22_23
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_24_25
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_26_27
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_27_28
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_3_4
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_4_5
import org.wordpress.android.fluxc.persistence.migrations.MIGRATION_5_6
Expand Down Expand Up @@ -127,7 +127,7 @@ abstract class WCAndroidDatabase : RoomDatabase(), TransactionExecutor {
.addMigrations(MIGRATION_21_22)
.addMigrations(MIGRATION_22_23)
.addMigrations(MIGRATION_24_25)
.addMigrations(MIGRATION_26_27)
.addMigrations(MIGRATION_27_28)
.build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ internal val MIGRATION_24_25 = object : Migration(24, 25) {
* We are storing "needs_payment" and "needs_processing" into OrderEntity property.
* This information will make rendering the UI easier.
*/
internal val MIGRATION_26_27 = object : Migration(25, 26) {
internal val MIGRATION_27_28 = object : Migration(27, 28) {
@Suppress("LongMethod")
override fun migrate(database: SupportSQLiteDatabase) {
database.apply {
Expand Down Expand Up @@ -881,8 +881,8 @@ internal val MIGRATION_26_27 = object : Migration(25, 26) {
`metaData` TEXT NOT NULL,
`paymentUrl` TEXT NOT NULL DEFAULT '',
`isEditable` INTEGER NOT NULL DEFAULT 1,
`needsPayment` INTEGER NOT NULL DEFAULT 0,
`needsProcessing` INTEGER NOT NULL DEFAULT 0,
`needsPayment` INTEGER,
`needsProcessing` INTEGER,
PRIMARY KEY(`localSiteId`, `orderId`)
)
""".trimIndent()
Expand Down

0 comments on commit d2cbed3

Please sign in to comment.