Peter Mutwiri commited on
Commit Β·
d8e13ad
1
Parent(s): 96bc619
removed problematic schema
Browse files- app/db.py +1 -7
- app/main.py +0 -14
app/db.py
CHANGED
|
@@ -85,13 +85,7 @@ def transactional_conn(org_id: str):
|
|
| 85 |
finally:
|
| 86 |
conn.close()
|
| 87 |
|
| 88 |
-
|
| 89 |
-
"""
|
| 90 |
-
π₯ DEV ONLY: Brutally drops schema_versions table to fix corrupted INTEGER PK schema.
|
| 91 |
-
Run ONCE via API endpoint, then REMOVE this function from codebase.
|
| 92 |
-
"""
|
| 93 |
-
conn.execute("DROP TABLE IF EXISTS main.schema_versions")
|
| 94 |
-
print("[delete] π₯ Dropped main.schema_versions (dev wipe)")
|
| 95 |
# ==================== SCHEMA EVOLUTION ==================== #
|
| 96 |
def ensure_raw_table(conn: duckdb.DuckDBPyConnection):
|
| 97 |
"""
|
|
|
|
| 85 |
finally:
|
| 86 |
conn.close()
|
| 87 |
|
| 88 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# ==================== SCHEMA EVOLUTION ==================== #
|
| 90 |
def ensure_raw_table(conn: duckdb.DuckDBPyConnection):
|
| 91 |
"""
|
app/main.py
CHANGED
|
@@ -131,20 +131,6 @@ app = FastAPI(
|
|
| 131 |
}
|
| 132 |
)
|
| 133 |
|
| 134 |
-
@app.post("/api/v1/admin/wipe-schema")
|
| 135 |
-
def wipe_schema_versions_table(org_id: str = Query(..., description="Organization ID")):
|
| 136 |
-
"""
|
| 137 |
-
π₯ DEV ONLY: Emergency wipe of schema_versions table.
|
| 138 |
-
USE ONCE PER ORG, THEN REMOVE THIS ENDPOINT IMMEDIATELY.
|
| 139 |
-
"""
|
| 140 |
-
try:
|
| 141 |
-
from app.db import get_conn, delete_problematic_schema_versions_table
|
| 142 |
-
conn = get_conn(org_id)
|
| 143 |
-
delete_problematic_schema_versions_table(conn)
|
| 144 |
-
conn.close()
|
| 145 |
-
return {"status": "wiped", "message": "schema_versions deleted. Remove this endpoint now."}
|
| 146 |
-
except Exception as e:
|
| 147 |
-
raise HTTPException(status_code=500, detail=str(e))
|
| 148 |
# βββ Request ID Middleware βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 149 |
@app.middleware("http")
|
| 150 |
async def add_request_tracking(request: Request, call_next):
|
|
|
|
| 131 |
}
|
| 132 |
)
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
# βββ Request ID Middleware βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 135 |
@app.middleware("http")
|
| 136 |
async def add_request_tracking(request: Request, call_next):
|