ワンクリックで
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 職業分類に基づく
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.
| 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.