collabrix/scripts/add_profile_picture_column.py
DGSoft 93b98cfb5c Initial commit: Team Chat System with Code Snippet Library
- Complete chat application similar to Microsoft Teams
- Code snippet library with syntax highlighting
- Real-time messaging with WebSockets
- File upload with Office integration
- Department-based permissions
- Dark/Light theme support
- Production deployment with SSL/Reverse Proxy
- Docker containerization
- PostgreSQL database with SQLModel ORM
2025-12-09 22:25:03 +01:00

44 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Add profile_picture column to user table"""
import sys
sys.path.insert(0, '/home/OfficeDesk/backend')
import psycopg2
def main():
# Connect to database
conn = psycopg2.connect('postgresql://postgres:your_password@192.168.0.19/OfficeDesk')
cur = conn.cursor()
try:
# Check if column already exists
cur.execute("""
SELECT column_name
FROM information_schema.columns
WHERE table_name='user' AND column_name='profile_picture'
""")
if cur.fetchone():
print("✓ Column 'profile_picture' already exists")
else:
# Add profile_picture column
cur.execute("""
ALTER TABLE "user"
ADD COLUMN profile_picture VARCHAR
""")
conn.commit()
print("✓ Added 'profile_picture' column to user table")
except Exception as e:
conn.rollback()
print(f"❌ Error: {e}")
return 1
finally:
cur.close()
conn.close()
return 0
if __name__ == "__main__":
sys.exit(main())