Spaces:
3SCError404
/
Paused

File size: 1,375 Bytes
b7980f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
import asyncio
from core.database import async_session_factory
from models.workspace import Workspace
from models.project import Project
from sqlalchemy import select

async def create_diagnostic_project():
    async with async_session_factory() as db:
        # 1. Find Acme Workspace
        ws_result = await db.execute(select(Workspace).where(Workspace.name == "Acme Corp"))
        ws = ws_result.scalar_one_or_none()
        
        if not ws:
            # Fallback to any workspace
            ws_result = await db.execute(select(Workspace).limit(1))
            ws = ws_result.scalar_one_or_none()
            
        if not ws:
            print("ERROR: No workspace found. Please run seed.py first.")
            return

        # 2. Create Project
        project = Project(
            name="Nexus Many-to-Many Launch",
            description="Diagnostic project to verify context-aware lookup and global visibility.",
            status="active",
            workspace_id=ws.id
        )
        db.add(project)
        await db.commit()
        await db.refresh(project)
        
        print("\n--- Project Created Successfully ---")
        print(f"PROJECT_ID: {project.id}")
        print(f"WORKSPACE: {ws.name} ({ws.id})")
        print("------------------------------------\n")

if __name__ == "__main__":
    asyncio.run(create_diagnostic_project())