mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
feat: migrate SQLAlchemy from 1.4 to 2.0 with ORM style
- Remove encode/databases dependency, use native SQLAlchemy 2.0 async - Convert all table definitions to Declarative Mapping pattern - Update all controllers to accept session parameter (dependency injection) - Convert all queries from Core style to ORM style - Remove PostgreSQL compatibility checks (PostgreSQL only now) - Add proper typing for engine and session factories
This commit is contained in:
@@ -3,7 +3,7 @@ from logging.config import fileConfig
|
||||
from alembic import context
|
||||
from sqlalchemy import engine_from_config, pool
|
||||
|
||||
from reflector.db import metadata
|
||||
from reflector.db.base import metadata
|
||||
from reflector.settings import settings
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
@@ -25,8 +25,7 @@ target_metadata = metadata
|
||||
# ... etc.
|
||||
|
||||
|
||||
# don't use asyncpg for the moment
|
||||
settings.DATABASE_URL = settings.DATABASE_URL.replace("+asyncpg", "")
|
||||
# No need to modify URL, using sync engine from db module
|
||||
|
||||
|
||||
def run_migrations_offline() -> None:
|
||||
|
||||
Reference in New Issue
Block a user