24 lines
695 B
Python
24 lines
695 B
Python
import sqlite3
|
|
import os
|
|
|
|
DB_PATH = os.path.join(os.path.dirname(__file__), "onever_drive.db")
|
|
|
|
def migrate():
|
|
print(f"Connecting to database at {DB_PATH}...")
|
|
conn = sqlite3.connect(DB_PATH)
|
|
cursor = conn.cursor()
|
|
|
|
# Add auth_source column to users table
|
|
try:
|
|
cursor.execute("ALTER TABLE users ADD COLUMN auth_source VARCHAR(50) NOT NULL DEFAULT 'local'")
|
|
print("Column 'auth_source' added successfully to users.")
|
|
except sqlite3.OperationalError as e:
|
|
print(f"Column 'auth_source' could not be added (maybe it already exists?): {e}")
|
|
|
|
conn.commit()
|
|
conn.close()
|
|
print("Migration finished.")
|
|
|
|
if __name__ == "__main__":
|
|
migrate()
|