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>
14 lines
642 B
YAML
14 lines
642 B
YAML
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
|