Files
AutonetSellCar/update_db_ru.py
AutonetSellCar Deploy 2c99f6a2b1 Add deployment scripts and troubleshooting docs
- deploy_ru_server2.sh: Russian language deployment script for server2
- update_db_ru.py: Database migration for Russian columns
- TROUBLESHOOTING.md: Common issues and solutions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 18:57:16 +09:00

49 lines
1.7 KiB
Python

import sqlite3
conn = sqlite3.connect("/app/autonet.db")
cursor = conn.cursor()
# 1. 컬럼 추가 (이미 있으면 무시)
try:
cursor.execute("ALTER TABLE hero_banners ADD COLUMN title_ru VARCHAR(100)")
print("Added title_ru column")
except:
print("title_ru column already exists")
try:
cursor.execute("ALTER TABLE hero_banners ADD COLUMN subtitle_ru VARCHAR(200)")
print("Added subtitle_ru column")
except:
print("subtitle_ru column already exists")
conn.commit()
# 2. 러시아어 번역 추가
translations = {
"모하비 더 마스터": ("Mohave The Master", "Мохаве Мастер", "Мохаве Мастер"),
"신형 K5(DL3)": ("New K5 (DL3)", "Шинэ K5 (DL3)", "Новый K5 (DL3)"),
"더 뉴그랜드스타렉스": ("The New Grand Starex", "Шинэ Гранд Старекс", "Новый Гранд Старекс"),
"더 뉴Santa Fe": ("The New Santa Fe", "Шинэ Санта Фе", "Новый Санта Фе"),
"더 뉴 K7": ("The New K7", "Шинэ K7", "Новый K7"),
}
cursor.execute("SELECT id, title_ko FROM hero_banners")
for row in cursor.fetchall():
banner_id, title_ko = row
if title_ko in translations:
en, mn, ru = translations[title_ko]
cursor.execute(
"UPDATE hero_banners SET title_en=?, title_mn=?, title_ru=? WHERE id=?",
(en, mn, ru, banner_id)
)
print(f"Updated banner {banner_id}: {title_ko} -> EN: {en}, MN: {mn}, RU: {ru}")
conn.commit()
# 3. 확인
cursor.execute("SELECT id, title_ko, title_en, title_mn, title_ru FROM hero_banners")
print("\n=== Current Banner Data ===")
for row in cursor.fetchall():
print(row)
print("\nDone!")