mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-07 06:22:58 +08:00
- Updated import statements across multiple modules to use relative imports for better encapsulation. - Consolidated and organized the `__init__.py` files in various domain packages to expose necessary classes and functions. - Improved code readability and maintainability by grouping related imports and removing unused ones. - Ensured consistent import patterns across the domain, enhancing the overall structure of the codebase.
23 lines
503 B
Python
23 lines
503 B
Python
from tortoise import Tortoise
|
|
|
|
from domain.adapters import runtime_registry
|
|
|
|
TORTOISE_ORM = {
|
|
"connections": {"default": "sqlite://data/db/db.sqlite3"},
|
|
"apps": {
|
|
"models": {
|
|
"models": ["models.database"],
|
|
"default_connection": "default",
|
|
}
|
|
},
|
|
}
|
|
|
|
async def init_db():
|
|
await Tortoise.init(config=TORTOISE_ORM)
|
|
await Tortoise.generate_schemas()
|
|
await runtime_registry.refresh()
|
|
|
|
|
|
async def close_db():
|
|
await Tortoise.close_connections()
|