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>
This commit is contained in:
36
backend/add_exchange_rate_columns.py
Normal file
36
backend/add_exchange_rate_columns.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Add exchange rate weight columns to system_settings table
|
||||
"""
|
||||
import sqlite3
|
||||
|
||||
def upgrade():
|
||||
conn = sqlite3.connect('autonet.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Check existing columns
|
||||
cursor.execute("PRAGMA table_info(system_settings)")
|
||||
columns = [col[1] for col in cursor.fetchall()]
|
||||
|
||||
new_columns = [
|
||||
('exchange_rate_weight_usd', 'FLOAT DEFAULT 0.0'),
|
||||
('exchange_rate_weight_mnt', 'FLOAT DEFAULT 0.0'),
|
||||
('exchange_rate_weight_rub', 'FLOAT DEFAULT 0.0'),
|
||||
('exchange_rate_weight_cny', 'FLOAT DEFAULT 0.0'),
|
||||
]
|
||||
|
||||
for col_name, col_type in new_columns:
|
||||
if col_name not in columns:
|
||||
try:
|
||||
cursor.execute(f'ALTER TABLE system_settings ADD COLUMN {col_name} {col_type}')
|
||||
print(f'Added column: {col_name}')
|
||||
except Exception as e:
|
||||
print(f'Error adding {col_name}: {e}')
|
||||
else:
|
||||
print(f'Column {col_name} already exists')
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print('Database migration complete!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
upgrade()
|
||||
Reference in New Issue
Block a user