迁移没有正确处理:

时间:2021-06-15 09:04:16

标签: java android kotlin android-room

升级数据库时出现此错误:

java.lang.IllegalStateException:迁移没有正确处理:seriesPosition(com.redline.xstreamredline.db.entities.SeriesPosition)。

    <ImageView
        android:src="@drawable/empty_image"
        android:id="@+id/image"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

我不知道如何指定索引。

         Glide.with(context).asBitmap().load(imageList[position]).error(emptyImage)
                .format(DecodeFormat.PREFER_ARGB_8888)
                .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
                .into(holder.binding.image)

1 个答案:

答案 0 :(得分:0)

要定义复合主键,您可以在实体注释中使用 primaryKeys 参数,例如:-

@Entity(tableName = "seriesPosition", primaryKeys = ["portalUid","seriesId","episodeId"])