new awesome build
This commit is contained in:
28
APP_PROFILER/scripts/add_public_ip_column.py
Normal file
28
APP_PROFILER/scripts/add_public_ip_column.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
DB_FILE = "ovpn_profiler.db"
|
||||
|
||||
def migrate():
|
||||
if not os.path.exists(DB_FILE):
|
||||
print(f"Database {DB_FILE} not found!")
|
||||
return
|
||||
|
||||
conn = sqlite3.connect(DB_FILE)
|
||||
cursor = conn.cursor()
|
||||
|
||||
try:
|
||||
print("Attempting to add public_ip column...")
|
||||
cursor.execute("ALTER TABLE system_settings ADD COLUMN public_ip TEXT")
|
||||
conn.commit()
|
||||
print("Success: Column public_ip added.")
|
||||
except sqlite3.OperationalError as e:
|
||||
if "duplicate column name" in str(e):
|
||||
print("Column public_ip already exists.")
|
||||
else:
|
||||
print(f"Error: {e}")
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
migrate()
|
||||
Reference in New Issue
Block a user