Init Repo
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
Migration script to add avatar_url field to users table
|
||||
"""
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
def migrate_avatar_field():
|
||||
"""Add avatar_url column to users table"""
|
||||
db_path = "vfx_project_management.db"
|
||||
|
||||
if not os.path.exists(db_path):
|
||||
print(f"Database file {db_path} not found!")
|
||||
return
|
||||
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
try:
|
||||
# Check if column already exists
|
||||
cursor.execute("PRAGMA table_info(users)")
|
||||
columns = [column[1] for column in cursor.fetchall()]
|
||||
|
||||
if 'avatar_url' in columns:
|
||||
print("✓ avatar_url column already exists in users table")
|
||||
else:
|
||||
# Add avatar_url column
|
||||
cursor.execute("ALTER TABLE users ADD COLUMN avatar_url TEXT")
|
||||
conn.commit()
|
||||
print("✓ Added avatar_url column to users table")
|
||||
|
||||
print("\nMigration completed successfully!")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error during migration: {e}")
|
||||
conn.rollback()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
migrate_avatar_field()
|
||||
Reference in New Issue
Block a user