fix: suppression de la contrainte FK tasks→projects (DB v3)
La contrainte FOREIGN KEY sur tasks.project_id causait des crashs systématiques dans une app sync-first où les projets et tâches arrivent de l'API sans garantie d'ordre strict. La cohérence est gérée côté serveur Bonsai ; inutile de la dupliquer en base locale. fallbackToDestructiveMigration() recrée la DB proprement au démarrage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,7 @@ import com.planify.mobile.data.local.entity.TaskEntity
|
||||
ReminderEntity::class,
|
||||
SourceEntity::class,
|
||||
],
|
||||
version = 2,
|
||||
version = 3,
|
||||
exportSchema = true,
|
||||
)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
@@ -2,20 +2,11 @@ package com.planify.mobile.data.local.entity
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(
|
||||
tableName = "tasks",
|
||||
foreignKeys = [
|
||||
ForeignKey(
|
||||
entity = ProjectEntity::class,
|
||||
parentColumns = ["id"],
|
||||
childColumns = ["project_id"],
|
||||
onDelete = ForeignKey.CASCADE
|
||||
)
|
||||
],
|
||||
indices = [
|
||||
Index("project_id"),
|
||||
Index("section_id"),
|
||||
|
||||
Reference in New Issue
Block a user