Initial commit: SIBU 2.0 MISSION

This commit is contained in:
2026-02-21 09:53:31 -05:00
commit 0c7aa53c8b
400 changed files with 67708 additions and 0 deletions

24
backend/setup_db.py Normal file
View File

@ -0,0 +1,24 @@
import asyncio
import asyncpg
async def setup_db():
try:
# Connect to default postgres DB
conn = await asyncpg.connect("postgresql://postgres:postgres@localhost:5432/postgres")
# Check if sibu exists
dbs = await conn.fetch("SELECT datname FROM pg_database WHERE datname = 'sibu'")
if not dbs:
print("Creating database 'sibu'...")
# We can't run CREATE DATABASE inside a transaction
await conn.execute("CREATE DATABASE sibu")
print("Database 'sibu' created!")
else:
print("Database 'sibu' already exists.")
await conn.close()
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
asyncio.run(setup_db())