Remove deprecated stage_focus column and update database path for consistency; add schema verification script and document schema mismatch fixes
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Quick test to verify the database schema matches between app and preprocessor.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, "/home/oluwasanmi/Documents/Work/MKD/anton_wireframe/app")
|
||||
|
||||
from db.db import engine
|
||||
from sqlalchemy import inspect
|
||||
|
||||
# Get table info
|
||||
inspector = inspect(engine)
|
||||
|
||||
print("🔍 Checking database schema...")
|
||||
print(f"Database: {engine.url}\n")
|
||||
|
||||
# Check investors table
|
||||
if "investors" in inspector.get_table_names():
|
||||
print("✅ 'investors' table exists")
|
||||
columns = inspector.get_columns("investors")
|
||||
|
||||
print("\nColumns in 'investors' table:")
|
||||
for col in columns:
|
||||
print(f" - {col['name']}: {col['type']}")
|
||||
|
||||
# Check for stage_focus
|
||||
column_names = [col["name"] for col in columns]
|
||||
if "stage_focus" in column_names:
|
||||
print("\n⚠️ WARNING: 'stage_focus' column still exists in database!")
|
||||
print(" This should be removed as it's deprecated.")
|
||||
else:
|
||||
print("\n✅ Good: 'stage_focus' column not in database (as expected)")
|
||||
|
||||
# Check for required columns
|
||||
required_columns = [
|
||||
"aum",
|
||||
"investment_thesis",
|
||||
"portfolio_highlights",
|
||||
"linked_documents",
|
||||
"researcher_notes",
|
||||
"sources",
|
||||
]
|
||||
missing = [col for col in required_columns if col not in column_names]
|
||||
|
||||
if missing:
|
||||
print(f"\n❌ Missing columns: {', '.join(missing)}")
|
||||
else:
|
||||
print("\n✅ All required enriched columns present")
|
||||
|
||||
else:
|
||||
print("❌ 'investors' table not found!")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("Schema verification complete!")
|
||||
print("=" * 60)
|
||||
Reference in New Issue
Block a user