一键导入
modify-room-database
Instructions for modifying the Room caching database in MemosM.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Instructions for modifying the Room caching database in MemosM.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | Modify Room Database |
| description | Instructions for modifying the Room caching database in MemosM. |
MemosM uses Android Room for local caching.
Entities are located in app/src/main/java/org/example/memosm/data/cache/. Define your data class and annotate it with @Entity.
@Entity(tableName = "my_custom_table")
data class CachedData(
@PrimaryKey val id: String,
val content: String
)
Add query methods to app/src/main/java/org/example/memosm/data/cache/MemoDao.kt (or create a new DAO).
@Dao
interface MemoDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertData(data: CachedData)
}
Note: If you create a new DAO, expose it in MemoCacheDatabase.kt and provide it in Koin (Modules.kt).
If you changed an existing entity or added a new one, you must increment the version in MemoCacheDatabase.kt.
@Database(
entities = [CachedMemo::class, CachedData::class],
version = 2, // <-- Increment this
exportSchema = false
)
abstract class MemoCacheDatabase : RoomDatabase() { ... }
In a production app, you should also provide a Migration block, but depending on the user requirements, a simple destructive migration (fallbackToDestructiveMigration()) might be used if it's just a pure cache. Check existing logic in MemoCacheDatabase.kt to follow the project's strategy.
Instructions for adding a new API endpoint handling versioning backward compatibility in MemosM.
Instructions for scaffolding a new Jetpack Compose screen or component and using Koin for ViewModel injection in MemosM.