버그 수정: PostgreSQL 데이터베이스 전체 용량 조회 권한 부족 시 테이블 기준 대체 조회 적용 및 프론트엔드 에러 툴팁 보완
This commit is contained in:
@@ -381,8 +381,15 @@ async def log_ui_event(data: UiEventRequest, current_user = Depends(get_current_
|
||||
async def get_database_size(db: Session = Depends(get_db), current_user = Depends(get_current_user)):
|
||||
try:
|
||||
dialect = db.get_bind().dialect.name
|
||||
size_bytes = 0
|
||||
if dialect == "postgresql":
|
||||
size_bytes = int(db.execute(text("SELECT pg_database_size(current_database())")).scalar() or 0)
|
||||
try:
|
||||
size_bytes = int(db.execute(text("SELECT pg_database_size(current_database())")).scalar() or 0)
|
||||
except Exception:
|
||||
try:
|
||||
size_bytes = int(db.execute(text("SELECT pg_total_relation_size('orders')")).scalar() or 0)
|
||||
except Exception:
|
||||
size_bytes = 0
|
||||
elif dialect == "sqlite":
|
||||
database_path = db.get_bind().url.database or "app.db"
|
||||
if not os.path.isabs(database_path):
|
||||
|
||||
Reference in New Issue
Block a user