GitHub Actions commited on
Commit ยท
b8365c8
1
Parent(s): 6ceb644
Auto-deploy from GitHub Actions - 2026-01-21 12:20:57
Browse files- README.md +0 -0
- app/migrations.py +17 -15
README.md
CHANGED
|
Binary files a/README.md and b/README.md differ
|
|
|
app/migrations.py
CHANGED
|
@@ -318,14 +318,15 @@ def check_and_migrate_db(app):
|
|
| 318 |
except Exception as e:
|
| 319 |
logger.error(f"merged_image_path ์ปฌ๋ผ ์ถ๊ฐ ์คํจ: {e}")
|
| 320 |
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
|
|
|
| 329 |
SELECT constraint_name
|
| 330 |
FROM information_schema.table_constraints
|
| 331 |
WHERE table_name = 'role_analysis'
|
|
@@ -337,18 +338,19 @@ def check_and_migrate_db(app):
|
|
| 337 |
logger.info(f"role_analysis ํ
์ด๋ธ์์ ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด ์ ๊ฑฐ ์ค: {constraints}")
|
| 338 |
for constraint_name in constraints:
|
| 339 |
try:
|
| 340 |
-
|
| 341 |
logger.info(f"'{constraint_name}' ์ ์ฝ์กฐ๊ฑด ์ ๊ฑฐ ์๋ฃ")
|
| 342 |
except Exception as e:
|
| 343 |
logger.warning(f"'{constraint_name}' ์ ๊ฑฐ ์คํจ (๋ฌด์): {e}")
|
| 344 |
-
|
|
|
|
| 345 |
else:
|
| 346 |
logger.info("role_analysis ํ
์ด๋ธ์ ์ ๊ฑฐํ ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด์ด ์์ต๋๋ค.")
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
|
| 353 |
logger.info("๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ง์ด๊ทธ๋ ์ด์
์๋ฃ")
|
| 354 |
|
|
|
|
| 318 |
except Exception as e:
|
| 319 |
logger.error(f"merged_image_path ์ปฌ๋ผ ์ถ๊ฐ ์คํจ: {e}")
|
| 320 |
|
| 321 |
+
# 14. role_analysis ํ
์ด๋ธ์ ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด ์ ๊ฑฐ
|
| 322 |
+
# ๊ฐ์ file_id, role_prompt_id ์กฐํฉ์ผ๋ก ์ฌ๋ฌ ๋ถ์ ๊ฒฐ๊ณผ๋ฅผ ์ ์ฅํ ์ ์๋๋ก ํจ
|
| 323 |
+
if 'role_analysis' in table_names:
|
| 324 |
+
logger.info("role_analysis ํ
์ด๋ธ ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด ํ์ธ ์ค...")
|
| 325 |
+
try:
|
| 326 |
+
if engine.dialect.name == 'postgresql':
|
| 327 |
+
# PostgreSQL: ์๋ก์ด connection์ผ๋ก ์ ์ฝ์กฐ๊ฑด ํ์ธ ๋ฐ ์ ๊ฑฐ
|
| 328 |
+
with engine.connect() as role_conn:
|
| 329 |
+
result = role_conn.execute(text("""
|
| 330 |
SELECT constraint_name
|
| 331 |
FROM information_schema.table_constraints
|
| 332 |
WHERE table_name = 'role_analysis'
|
|
|
|
| 338 |
logger.info(f"role_analysis ํ
์ด๋ธ์์ ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด ์ ๊ฑฐ ์ค: {constraints}")
|
| 339 |
for constraint_name in constraints:
|
| 340 |
try:
|
| 341 |
+
role_conn.execute(text(f'ALTER TABLE role_analysis DROP CONSTRAINT IF EXISTS "{constraint_name}"'))
|
| 342 |
logger.info(f"'{constraint_name}' ์ ์ฝ์กฐ๊ฑด ์ ๊ฑฐ ์๋ฃ")
|
| 343 |
except Exception as e:
|
| 344 |
logger.warning(f"'{constraint_name}' ์ ๊ฑฐ ์คํจ (๋ฌด์): {e}")
|
| 345 |
+
role_conn.commit()
|
| 346 |
+
logger.info("role_analysis ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด ์ ๊ฑฐ ์๋ฃ - ์ด์ ๊ฐ์ Role๋ก ์ฌ๋ฌ ๋ถ์์ด ๊ฐ๋ฅํฉ๋๋ค.")
|
| 347 |
else:
|
| 348 |
logger.info("role_analysis ํ
์ด๋ธ์ ์ ๊ฑฐํ ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด์ด ์์ต๋๋ค.")
|
| 349 |
+
else:
|
| 350 |
+
# SQLite๋ ์ ์ฝ์กฐ๊ฑด ์ง์ ์ ๊ฑฐ ๋ถ๊ฐ - ์ฑ ์์ ์์๋ ๊ฑด๋๋ฐ๊ณ ๋ณ๋ ๋ง์ด๊ทธ๋ ์ด์
์คํฌ๋ฆฝํธ ์ฌ์ฉ
|
| 351 |
+
logger.info("SQLite: role_analysis ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด์ ๋ณ๋ ๋ง์ด๊ทธ๋ ์ด์
์คํฌ๋ฆฝํธ๋ก ์ฒ๋ฆฌ๋ฉ๋๋ค.")
|
| 352 |
+
except Exception as e:
|
| 353 |
+
logger.warning(f"role_analysis ์ ๋ํฌ ์ ์ฝ์กฐ๊ฑด ํ์ธ/์ ๊ฑฐ ์ค ์ค๋ฅ (๋ฌด์ ๊ฐ๋ฅ): {e}")
|
| 354 |
|
| 355 |
logger.info("๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ง์ด๊ทธ๋ ์ด์
์๋ฃ")
|
| 356 |
|