VortexCommerceBackend / set_admin.py
hisham-cmd's picture
Upload set_admin.py
a5f4a08 verified
Raw History Blame
763 Bytes
import sqlite3
import os
# Database path
DB_PATH = os.path.join(os.path.dirname(__file__), "vortex.db")
def set_all_admins():
if not os.path.exists(DB_PATH):
print(f"Error: Database not found at {DB_PATH}")
return
try:
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
# Update all users to admin role for development
cursor.execute("UPDATE users SET role = 'admin'")
conn.commit()
updated_count = cursor.rowcount
print(f"Successfully updated {updated_count} users to ADMIN role.")
conn.close()
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
set_all_admins()