feat(chat): 聊天单向删除

This commit is contained in:
xingc
2025-05-15 18:24:05 +08:00
parent 99f15cff84
commit cc097a587f
8 changed files with 147 additions and 43 deletions

View File

@@ -27,6 +27,30 @@ from core.db.models import BaseModel # 假设你的 SQLAlchemy 模型在 models
target_metadata = BaseModel.metadata
def run_migrations_offline() -> None:
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
)
with context.begin_transaction():
context.run_migrations()
def do_run_migrations(connection):
context.configure(
connection=connection,
@@ -62,4 +86,4 @@ else:
asyncio.set_event_loop(loop)
# 运行迁移
loop.run_until_complete(run_migrations_online())
loop.run_until_complete(run_migrations_online())