Data layer: Room entities, DAOs, database with exported schema

Milestone 2. Medication / DoseTime / DoseLog per the brief's model.
DoseLog.doseTimeId is SET_NULL (schedule edits must not erase adherence
history) while medId CASCADEs; DoseLog.amount is snapshotted at logging
time so later dose changes don't rewrite the record. Inventory decrement
is a single SQL UPDATE clamped at 0 to stay race-free under escalating
notifications. Enums stored as TEXT; schema exported to app/schemas as
the migration baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-06-10 13:34:41 +02:00
commit b884885e40
10 changed files with 614 additions and 2 deletions

View file

@ -3,6 +3,12 @@ plugins {
// AGP 9 has built-in Kotlin (org.jetbrains.kotlin.android is gone); only the
// compiler sub-plugins are applied separately, pinned to AGP's bundled KGP version.
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.ksp)
}
ksp {
// Commit exported schemas: migration baseline for a DB that is a medical record.
arg("room.schemaLocation", "$projectDir/schemas")
}
android {
@ -48,5 +54,8 @@ dependencies {
implementation(libs.compose.ui.tooling.preview)
debugImplementation(libs.compose.ui.tooling)
implementation(libs.room.runtime)
ksp(libs.room.compiler)
testImplementation(libs.junit)
}