File size: 943 Bytes
09801ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import asyncio
import asyncpg
from urllib.parse import urlparse

async def main():
    try:
        conn = await asyncpg.connect("postgresql://datavision:datavision_dev@localhost:5433/datavision")
        print("Successfully connected!")
        
        # Check if joined_at exists
        exists = await conn.fetchval("""
            SELECT EXISTS (
                SELECT 1 
                FROM information_schema.columns 
                WHERE table_name='workspace_members' AND column_name='joined_at'
            );
        """)
        print(f"joined_at exists: {exists}")
        
        if not exists:
            print("Adding joined_at...")
            await conn.execute("ALTER TABLE workspace_members ADD COLUMN joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;")
            print("Added successfully!")
            
        await conn.close()
    except Exception as e:
        print(f"Error: {e}")

asyncio.run(main())