mirror of
https://github.com/OHV-IT/collabrix.git
synced 2025-12-15 16:48:36 +01:00
- Complete chat application similar to Microsoft Teams - Code snippet library with syntax highlighting - Real-time messaging with WebSockets - File upload with Office integration - Department-based permissions - Dark/Light theme support - Production deployment with SSL/Reverse Proxy - Docker containerization - PostgreSQL database with SQLModel ORM
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Add is_admin column to user table"""
|
|
import psycopg2
|
|
import sys
|
|
|
|
def main():
|
|
try:
|
|
# Connect to database
|
|
conn = psycopg2.connect('postgresql://postgres:your_password@192.168.0.19/OfficeDesk')
|
|
cur = conn.cursor()
|
|
|
|
print("Adding is_admin column to user table...")
|
|
|
|
# Add is_admin column with default value False
|
|
cur.execute('''
|
|
ALTER TABLE "user"
|
|
ADD COLUMN IF NOT EXISTS is_admin BOOLEAN NOT NULL DEFAULT FALSE
|
|
''')
|
|
|
|
# Set Ronny (user_id=1) as admin
|
|
cur.execute('UPDATE "user" SET is_admin = true WHERE id = 1')
|
|
|
|
conn.commit()
|
|
|
|
# Verify the change
|
|
cur.execute('SELECT id, username, email, is_admin FROM "user" WHERE id = 1')
|
|
result = cur.fetchone()
|
|
print(f"\n✅ Migration successful!")
|
|
print(f"User: {result[1]} (ID: {result[0]}, Email: {result[2]}, Admin: {result[3]})")
|
|
|
|
cur.close()
|
|
conn.close()
|
|
|
|
except Exception as e:
|
|
print(f"❌ Error: {e}")
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|