update:1.重构项目数据库初始化和迁移逻辑,使用Alembic数据库管理工具

This commit is contained in:
xiamuceer
2025-12-26 15:05:48 +08:00
parent a5788e75ae
commit f32e51b594
39 changed files with 2249 additions and 2037 deletions
+48
View File
@@ -0,0 +1,48 @@
# Alembic Database Migration Profile - SQLite
# Database version management for the MuMuAINovel project
[alembic]
# Migration Script storage directory (SQLite)
script_location = alembic/sqlite
# Template File Path (for generating migration scripts)
file_template = %%(year)d%%(month).2d%%(day).2d_%%(hour).2d%%(minute).2d_%%(rev)s_%%(slug)s
# Database connection string
# Note: The actual connection string is read from the environment variable in env.py
# sqlalchemy.url = sqlite+aiosqlite:///data/ai_story.db
# Log Configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S