Files
AutonetSellCar/backend/migrate_translations.py
AutonetSellCar Deploy 1f0dcb1ddb Initial commit: AutonetSellCar platform with deployment system
- Frontend: Next.js 14 with TypeScript
- Backend: FastAPI with SQLAlchemy
- Agent: Carmodoo sync agent
- Deployment: Docker Compose based staging/production setup
- Scripts: Automated deployment with rollback support

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 13:24:39 +09:00

41 lines
1.1 KiB
Python

"""
Migration script to add dealer_description translation columns to cars table
Run: python migrate_translations.py
"""
import sqlite3
import os
# DB path
DB_PATH = os.path.join(os.path.dirname(__file__), 'autonet.db')
def migrate():
print(f"Connecting to: {DB_PATH}")
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
# Check existing columns
cursor.execute('PRAGMA table_info(cars)')
columns = [col[1] for col in cursor.fetchall()]
print(f"Existing columns: {len(columns)} columns")
# New columns to add
new_columns = [
('dealer_description_en', 'TEXT'),
('dealer_description_mn', 'TEXT'),
('dealer_description_ru', 'TEXT')
]
for col_name, col_type in new_columns:
if col_name not in columns:
cursor.execute(f'ALTER TABLE cars ADD COLUMN {col_name} {col_type}')
print(f'Added column: {col_name}')
else:
print(f'Column already exists: {col_name}')
conn.commit()
conn.close()
print('Migration complete!')
if __name__ == '__main__':
migrate()