Skip to content

Conversation

@lan17
Copy link
Owner

@lan17 lan17 commented Jan 19, 2026

Why

SQLite is now a supported persistent backend, so migrations and DB tests must work on both PostgreSQL and SQLite without manual workarounds.

What changed

  • Portable migrations: initial revision now uses JSONType, sa.func.now(), and dialect-aware JSON path indexes so PG and SQLite can both upgrade cleanly.
  • Identity alignment: clip_events.id matches the model’s Integer + Identity() for cross-backend auto-increment.
  • Alembic logging: keep existing loggers enabled during migration runs to preserve test log capture.
  • DB test reliability: SQLite tests that span multiple engines now use a file-based DSN so schema/data persist across connections.
  • Migration safety net: added a smoke test that runs alembic upgrade head, compares schema vs models, and performs a basic state/event roundtrip.
  • Documentation: added a concise dual-backend migration guide and referenced it from AGENTS.md.

How to validate

  • make check

Notes

  • The migration smoke test intentionally ignores SQLite’s identity-default reflection quirk and expression-index reflection warnings (SQLite limitation).

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 85.29412% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.70%. Comparing base (4c8342f) to head (cec4b5c).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
src/homesec/db/dialect.py 79.27% 23 Missing ⚠️
src/homesec/state/postgres.py 90.32% 6 Missing ⚠️
src/homesec/db/engine.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   73.47%   73.70%   +0.23%     
==========================================
  Files          53       57       +4     
  Lines        4625     4757     +132     
==========================================
+ Hits         3398     3506     +108     
- Misses       1227     1251      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lan17 lan17 changed the title Claude/add sqlite support ne sug fix: make migrations + tests dual-backend (pg/sqlite) Jan 19, 2026
@lan17 lan17 changed the title fix: make migrations + tests dual-backend (pg/sqlite) fix: SQLite support: make migrations + tests dual-backend (pg/sqlite) Jan 19, 2026
@lan17 lan17 changed the title fix: SQLite support: make migrations + tests dual-backend (pg/sqlite) feat: SQLite support: make migrations + tests dual-backend (pg/sqlite) Jan 19, 2026
@lan17 lan17 force-pushed the claude/add-sqlite-support-neSug branch from f4d9284 to 1ba488a Compare January 19, 2026 03:19
SQLite is now a supported persistent backend, so migrations and DB tests must work on both PostgreSQL and SQLite without manual workarounds.

- **Portable migrations**: initial revision now uses `JSONType`, `sa.func.now()`, and dialect-aware JSON path indexes so PG and SQLite can both upgrade cleanly.
- **Identity alignment**: `clip_events.id` matches the model’s `Integer + Identity()` for cross-backend auto-increment.
- **Alembic logging**: keep existing loggers enabled during migration runs to preserve test log capture.
- **DB test reliability**: SQLite tests that span multiple engines now use a file-based DSN so schema/data persist across connections.
- **Migration safety net**: added a smoke test that runs `alembic upgrade head`, compares schema vs models, and performs a basic state/event roundtrip.
- **Documentation**: added a concise dual-backend migration guide and referenced it from `AGENTS.md`.

- `make check`

- The migration smoke test intentionally ignores SQLite’s identity-default reflection quirk and expression-index reflection warnings (SQLite limitation).
@lan17 lan17 force-pushed the claude/add-sqlite-support-neSug branch from 1ba488a to cec4b5c Compare January 19, 2026 03:23
@lan17 lan17 closed this Jan 21, 2026
@lan17 lan17 deleted the claude/add-sqlite-support-neSug branch January 21, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants