GitHub Actions commited on
Commit
b8365c8
ยท
1 Parent(s): 6ceb644

Auto-deploy from GitHub Actions - 2026-01-21 12:20:57

Browse files
Files changed (2) hide show
  1. README.md +0 -0
  2. 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
- # 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: information_schema์—์„œ ์ œ์•ฝ์กฐ๊ฑด ํ™•์ธ
328
- result = conn.execute(text("""
 
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
- conn.execute(text(f'ALTER TABLE role_analysis DROP CONSTRAINT IF EXISTS "{constraint_name}"'))
341
  logger.info(f"'{constraint_name}' ์ œ์•ฝ์กฐ๊ฑด ์ œ๊ฑฐ ์™„๋ฃŒ")
342
  except Exception as e:
343
  logger.warning(f"'{constraint_name}' ์ œ๊ฑฐ ์‹คํŒจ (๋ฌด์‹œ): {e}")
344
- conn.commit()
 
345
  else:
346
  logger.info("role_analysis ํ…Œ์ด๋ธ”์— ์ œ๊ฑฐํ•  ์œ ๋‹ˆํฌ ์ œ์•ฝ์กฐ๊ฑด์ด ์—†์Šต๋‹ˆ๋‹ค.")
347
- else:
348
- # SQLite๋Š” ์ œ์•ฝ์กฐ๊ฑด ์ง์ ‘ ์ œ๊ฑฐ ๋ถˆ๊ฐ€ - ์•ฑ ์‹œ์ž‘ ์‹œ์—๋Š” ๊ฑด๋„ˆ๋›ฐ๊ณ  ๋ณ„๋„ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ ์‚ฌ์šฉ
349
- logger.info("SQLite: role_analysis ์œ ๋‹ˆํฌ ์ œ์•ฝ์กฐ๊ฑด์€ ๋ณ„๋„ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ์Šคํฌ๋ฆฝํŠธ๋กœ ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค.")
350
- except Exception as e:
351
- logger.warning(f"role_analysis ์œ ๋‹ˆํฌ ์ œ์•ฝ์กฐ๊ฑด ํ™•์ธ/์ œ๊ฑฐ ์ค‘ ์˜ค๋ฅ˜ (๋ฌด์‹œ ๊ฐ€๋Šฅ): {e}")
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