mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-10-30 19:52:03 +01:00
Phase 1: make ORM/migrations Postgres-compatible
Dialect-neutral fixes that keep SQLite behaviour unchanged: - event_observer: choose INSERT construct by bind dialect so the on_conflict upsert works on both SQLite and Postgres - database: map postgresql:// -> postgresql+asyncpg:// for async sessions (was sqlite-only), via a _to_async_url helper - models: import JSON from sqlalchemy (generic) not the sqlite dialect - alembic/env: render_as_batch only for SQLite (its ALTER TABLE workaround) Full SQLite test suite green (1045 passed) and fresh db upgrade builds all tables; black/flake8/mypy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
57488239c9
commit
9eab07d244
7 files changed
+58
-25
No files matched your search
+3
-1
@@ -58,7 +58,9 @@ def run_migrations_offline() -> None:
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
dialect_opts={"paramstyle": "named"},
|
||||
render_as_batch=True, # SQLite batch mode for ALTER TABLE
|
||||
# Batch mode is a SQLite-only workaround for its limited ALTER TABLE;
|
||||
# Postgres performs ALTERs directly.
|
||||
render_as_batch=url.startswith("sqlite"),
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
|
||||
Reference in new issue
Block a user