Support SQLModel UTC datetime migrations without downgrades

Merged
MA
24d ago
+147-14

The sqlmodel<0.0.45 cap downgraded SQLModel when upgrading recent Reflex 0.9.12 apps to the prerelease. Their generated migrations then failed because UTCDateTime disappeared, and database reads changed from aware to naive datetimes.

Remove the cap, retaining the existing >=0.0.24 floor, and update the lockfile to SQLModel 0.0.47. Document the upstream UTC-aware default and the explicit DateTime(timezone=False) option for apps that need naive storage. Correct the earlier dependency-refresh fragment, which claimed the cap preserved existing behavior for all users.

Addresses FINDING-005 in the October 6 prerelease results.

Validation:

  • The dependency-range regression failed before the change.
  • Database and optional-dependency modules pass (15 tests). Coverage includes generated UTCDateTime migration replay on a fresh database, an aware SQLite datetime roundtrip, and explicit naive storage in the existing callable-default migration test.
  • The full unit suite with SQLModel 0.0.47 passes: 11,273 passed, 159 skipped, with 79.13% coverage.
  • Ruff, repository formatting, pyright reflex tests, all applicable commit hooks, and uv lock --check pass.

Compatibility: applications already using SQLModel 0.0.45+ keep their UTC migrations and types. Older applications can retain naive storage by declaring the column type explicitly or keeping their existing SQLModel version. Adopting UTC storage for existing data requires the database-specific migration described in the linked upstream guide.

The unchanged release --check-dev-pins gate still flags reflex-base>=0.9.12.dev0, as on main; this PR adds no development pins.