T08: Drift schema mirroring the Room baseline

Three tables with CASCADE foreign keys, indices, WAL, and a real MigrationStrategy
from schema version 1. No destructive fallback, ever.

Two things needed deliberate handling. SQLite defaults foreign_keys to OFF and
Drift, unlike Room, does not enable it -- without the pragma every CASCADE is
decorative, so there is now a test that reads the pragma back. And Drift both
snake_cases columns and names row classes after tables; build.yaml sets
case_from_dart_to_sql: preserve so the schema stays column-for-column identical
to Room's, and @DataClassName keeps row types from colliding with the domain
models.

SchemaTest was instrumented and needed a device; the Drift version is a plain
unit test that runs in under a second with no emulator. 16 tests.

95 tests passing, analyze clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-15 01:13:45 -05:00
parent 398157b1f5
commit d7d9854dc9
5 changed files with 3749 additions and 0 deletions

13
build.yaml Normal file
View File

@@ -0,0 +1,13 @@
targets:
$default:
builders:
drift_dev:
options:
# Preserve Dart field names as SQL column names instead of snake_casing them.
#
# This keeps the schema column-for-column identical to the native app's Room
# schema (app/schemas/com.rippr.data.AppDatabase/2.json), which means the raw
# SQL in database.dart can stay byte-identical to the Kotlin DAO queries it was
# ported from -- much easier to review -- and leaves the door open to reading an
# old Room database file directly if an importer is ever wanted.
case_from_dart_to_sql: preserve