21 lines
611 B
Python
21 lines
611 B
Python
import sqlite3
|
|
import os
|
|
|
|
DB_PATH = os.path.join(os.path.dirname(__file__), "onever_drive.db")
|
|
|
|
def migrate():
|
|
print(f"Connecting to {DB_PATH}...")
|
|
conn = sqlite3.connect(DB_PATH)
|
|
cursor = conn.cursor()
|
|
try:
|
|
cursor.execute("ALTER TABLE registration_codes ADD COLUMN client_id INTEGER REFERENCES clients(id)")
|
|
print("Column 'client_id' added successfully to registration_codes.")
|
|
except sqlite3.OperationalError as e:
|
|
print(f"Error (maybe column already exists?): {e}")
|
|
finally:
|
|
conn.commit()
|
|
conn.close()
|
|
|
|
if __name__ == "__main__":
|
|
migrate()
|