Add source
This commit is contained in:
4
bot/modules/database/__init__.py
Normal file
4
bot/modules/database/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
"""
|
||||
Database module (ORM)
|
||||
"""
|
||||
|
||||
7
bot/modules/database/models.py
Normal file
7
bot/modules/database/models.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""
|
||||
ORM models for bot (imported from shared)
|
||||
"""
|
||||
from shared.database.models import User, Task, Download
|
||||
|
||||
__all__ = ["User", "Task", "Download"]
|
||||
|
||||
22
bot/modules/database/session.py
Normal file
22
bot/modules/database/session.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Database session management (wrapper over shared module)
|
||||
Uses unified module from shared/database/session.py
|
||||
"""
|
||||
from shared.database.session import (
|
||||
init_db,
|
||||
get_async_session_local,
|
||||
get_engine
|
||||
)
|
||||
|
||||
# For backward compatibility - get session factory
|
||||
def get_AsyncSessionLocal():
|
||||
"""Get session factory (for backward compatibility)"""
|
||||
return get_async_session_local()
|
||||
|
||||
# Create object for backward compatibility
|
||||
AsyncSessionLocal = get_async_session_local()
|
||||
engine = get_engine()
|
||||
|
||||
# Export functions
|
||||
__all__ = ['init_db', 'AsyncSessionLocal', 'engine']
|
||||
|
||||
Reference in New Issue
Block a user