增加代码知识库;修复文档处理内容;增加API设置
This commit is contained in:
@@ -6,6 +6,7 @@ from typing import Generator, Tuple
|
||||
from alembic.config import Config
|
||||
from alembic.config import main as alembic_main
|
||||
from alembic.migration import MigrationContext
|
||||
from alembic.script import ScriptDirectory
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.engine import Connection
|
||||
|
||||
@@ -52,13 +53,8 @@ class DatabaseMigrator:
|
||||
with self.database_connection() as connection:
|
||||
context = MigrationContext.configure(connection)
|
||||
current_rev = context.get_current_revision()
|
||||
heads = context.get_current_heads()
|
||||
|
||||
if not heads:
|
||||
logger.warning("No migration heads found. Database might not be initialized.")
|
||||
return True, current_rev or "None", "head"
|
||||
|
||||
head_rev = heads[0]
|
||||
script = ScriptDirectory.from_config(self.alembic_cfg)
|
||||
head_rev = script.get_current_head()
|
||||
return current_rev != head_rev, current_rev or "None", head_rev
|
||||
|
||||
def _get_alembic_config(self) -> Config:
|
||||
|
||||
Reference in New Issue
Block a user