Skip to content

Replace TinyDB with PostgreSQL#34

Open
max-tet wants to merge 3 commits intomainfrom
issue/25-replace-tinydb-with-postgres
Open

Replace TinyDB with PostgreSQL#34
max-tet wants to merge 3 commits intomainfrom
issue/25-replace-tinydb-with-postgres

Conversation

@max-tet
Copy link
Copy Markdown
Member

@max-tet max-tet commented Feb 24, 2026

Summary

  • Replace TinyDB (JSON file-based) with PostgreSQL using psycopg3 async for all database operations
  • Add yoyo-migrations for schema management with a single initial migration creating all 8 tables (installed_apps, identities, terminals, peers, backups, tours, app_usage_tracks, kv_store)
  • Convert all service, data model, and web endpoint files from sync TinyDB to async Postgres with per-entity DB modules
  • Add Docker Compose postgres service for both production and test environments
  • Bridge sync blinker signal handlers to async DB via asyncio.create_task()

Closes #25

Test plan

  • All existing tests pass (14 passed, 105 skipped due to TEST_ENV=full requirement)
  • Run full test suite with TEST_ENV=full in Docker environment
  • Verify yoyo migration applies cleanly on fresh Postgres
  • Test app installation/uninstallation lifecycle end-to-end
  • Test terminal pairing and identity management

🤖 Generated with Claude Code

max-tet and others added 3 commits February 24, 2026 17:03
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ockfile

- Fix peer.py key resolver: pre-load peers to avoid asyncio.run() in
  thread which would create incompatible event loop for connection pool
- Add column allowlists to dynamic update functions in identities.py,
  terminals.py, and peers.py to prevent SQL injection via dict keys
- Use psycopg.conninfo.make_conninfo() for safe connection string building
- Regenerate uv.lock to remove stale TinyDB entries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Replace TinyDB with a Postgres

1 participant