Initial commit – AufmaßCreater v2.35
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Add profile_image column to users table."""
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
db_path = os.path.join(os.path.dirname(__file__), '..', 'data', 'aufmass.db')
|
||||
db_path = os.path.normpath(db_path)
|
||||
|
||||
if not os.path.exists(db_path):
|
||||
print(f"DB not found at {db_path}")
|
||||
exit(0)
|
||||
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Check if column already exists
|
||||
cursor.execute("PRAGMA table_info(users)")
|
||||
cols = [row[1] for row in cursor.fetchall()]
|
||||
if 'profile_image' not in cols:
|
||||
cursor.execute("ALTER TABLE users ADD COLUMN profile_image VARCHAR(255)")
|
||||
print("Added profile_image column to users table.")
|
||||
else:
|
||||
print("Column profile_image already exists.")
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print("Done.")
|
||||
Reference in New Issue
Block a user