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:
49
backend/update_inquiry_db.py
Normal file
49
backend/update_inquiry_db.py
Normal file
@@ -0,0 +1,49 @@
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('D:/Workspace/claudeCode/AutonetSellCar.com/backend/car_platform.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Check existing columns in inquiries table
|
||||
cursor.execute('PRAGMA table_info(inquiries)')
|
||||
columns = cursor.fetchall()
|
||||
existing_cols = [col[1] for col in columns]
|
||||
print('Existing columns:', existing_cols)
|
||||
|
||||
# Add new columns if they don't exist
|
||||
new_columns = [
|
||||
('category', 'VARCHAR(50) DEFAULT "general"'),
|
||||
('subject', 'VARCHAR(200)'),
|
||||
('contact_email', 'VARCHAR(255)'),
|
||||
('contact_phone', 'VARCHAR(50)'),
|
||||
('admin_response', 'TEXT'),
|
||||
('responded_at', 'DATETIME'),
|
||||
('responded_by', 'INTEGER'),
|
||||
('updated_at', 'DATETIME'),
|
||||
]
|
||||
|
||||
for col_name, col_type in new_columns:
|
||||
if col_name not in existing_cols:
|
||||
try:
|
||||
cursor.execute(f'ALTER TABLE inquiries ADD COLUMN {col_name} {col_type}')
|
||||
print(f'Added column: {col_name}')
|
||||
except Exception as e:
|
||||
print(f'Error adding {col_name}: {e}')
|
||||
|
||||
# Create inquiry_messages table if not exists
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS inquiry_messages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
inquiry_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
is_admin BOOLEAN DEFAULT 0,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (inquiry_id) REFERENCES inquiries (id),
|
||||
FOREIGN KEY (user_id) REFERENCES users (id)
|
||||
)
|
||||
''')
|
||||
print('inquiry_messages table created/verified')
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print('Database update complete!')
|
||||
Reference in New Issue
Block a user