GitHub Actions
commited on
Commit
·
8ff5131
1
Parent(s):
1706263
Auto-deploy from GitHub Actions - 2025-12-11 09:40:37
Browse files- app/__init__.py +5 -0
app/__init__.py
CHANGED
|
@@ -265,6 +265,11 @@ def migrate_database(app: Flask) -> None:
|
|
| 265 |
if inspector.has_table('chat_message'):
|
| 266 |
columns = [c['name'] for c in inspector.get_columns('chat_message')]
|
| 267 |
with db.engine.begin() as conn:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
if 'input_tokens' not in columns:
|
| 269 |
logger.info("chat_message 테이블에 input_tokens 컬럼 추가 중...")
|
| 270 |
conn.execute(text("ALTER TABLE chat_message ADD COLUMN input_tokens INTEGER"))
|
|
|
|
| 265 |
if inspector.has_table('chat_message'):
|
| 266 |
columns = [c['name'] for c in inspector.get_columns('chat_message')]
|
| 267 |
with db.engine.begin() as conn:
|
| 268 |
+
# session_id 컬럼의 NOT NULL 제약조건 제거 (PostgreSQL)
|
| 269 |
+
if db.engine.dialect.name == 'postgresql':
|
| 270 |
+
logger.info("PostgreSQL: chat_message.session_id의 NOT NULL 제약조건 제거 시도...")
|
| 271 |
+
conn.execute(text("ALTER TABLE chat_message ALTER COLUMN session_id DROP NOT NULL"))
|
| 272 |
+
|
| 273 |
if 'input_tokens' not in columns:
|
| 274 |
logger.info("chat_message 테이블에 input_tokens 컬럼 추가 중...")
|
| 275 |
conn.execute(text("ALTER TABLE chat_message ADD COLUMN input_tokens INTEGER"))
|