File size: 1,306 Bytes
7f88bdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import psycopg
from psycopg.rows import dict_row

def main():
    conn_str = "postgresql://postgres:postgres@localhost:54322/postgres"
    with psycopg.connect(conn_str, row_factory=dict_row) as conn:
        with conn.cursor() as cur:
            # Find the org for the test user
            cur.execute("""
                SELECT o.id, o.name 
                FROM organizations o 
                JOIN members m ON o.id = m.organization_id 
                JOIN auth.users u ON m.user_id = u.id 
                WHERE u.email = 'tester@tenderhub.co.ke'
            """)
            row = cur.fetchone()
            if not row:
                print("Org not found for tester@tenderhub.co.ke")
                return
            
            org_id = row['id']
            print(f"Found Org: {row['name']} ({org_id})")
            
            # Update to WHITE_LABEL and add branding
            cur.execute("""
                UPDATE organizations 
                SET plan_type = 'WHITE_LABEL',
                    white_label_branding = '{"logoText": "ContractorElite", "logoIcon": "🏗️"}'
                WHERE id = %s
            """, (org_id,))
            conn.commit()
            print(f"Successfully elevated {org_id} to WHITE_LABEL with branding.")

if __name__ == "__main__":
    main()