mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
refactor: 收口 V3 分层架构与插件兼容边界
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
from typing import Tuple, Union
|
||||
|
||||
from app.runtime.config import settings
|
||||
from app.db import SessionFactory
|
||||
from app.application.database import get_configured_database_health
|
||||
from app.modules import _ModuleBase
|
||||
from app.schemas.types import ModuleType, OtherModulesType
|
||||
from sqlalchemy import text
|
||||
|
||||
|
||||
class PostgreSQLModule(_ModuleBase):
|
||||
@@ -52,12 +51,7 @@ class PostgreSQLModule(_ModuleBase):
|
||||
"""
|
||||
if settings.DB_TYPE != "postgresql":
|
||||
return None
|
||||
# 测试数据库连接
|
||||
db = SessionFactory()
|
||||
try:
|
||||
db.execute(text("SELECT 1"))
|
||||
except Exception as e:
|
||||
return False, f"PostgreSQL连接失败:{e}"
|
||||
finally:
|
||||
db.close()
|
||||
error = get_configured_database_health().test()
|
||||
if error:
|
||||
return False, f"PostgreSQL连接失败:{error}"
|
||||
return True, ""
|
||||
|
||||
Reference in New Issue
Block a user