refactor: move entities

This commit is contained in:
Junyan Qin
2025-03-10 22:34:45 +08:00
parent a0fd152d19
commit c1f4de425a
14 changed files with 105 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ import sqlalchemy.ext.asyncio as sqlalchemy_asyncio
import sqlalchemy
from . import database
from .entities import user, base
from ..entity.persistence import user, model, base
from ..core import app
from .databases import sqlite
@@ -34,6 +34,11 @@ class PersistenceManager:
await self.create_tables()
# auto migrate
async with self.get_db_engine().connect() as conn:
await conn.run_sync(self.meta.drop_all)
await conn.run_sync(self.meta.create_all)
async def create_tables(self):
# TODO: 对扩展友好