chore: Backend codebase cleanup and archiving of legacy scripts
This commit is contained in:
43
backend/archive_v1_scripts/debug_metadata.py
Normal file
43
backend/archive_v1_scripts/debug_metadata.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Biztosítjuk, hogy az aktuális könyvtár benne legyen az útvonalban
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".")))
|
||||
|
||||
try:
|
||||
print("🔍 Modellek betöltése...")
|
||||
from app.database import Base
|
||||
# Fontos: explicit importáljuk a models csomagot, hogy lefussanak az __init__.py importok
|
||||
import app.models
|
||||
print("✅ Importálás sikeres.\n")
|
||||
except ImportError as e:
|
||||
print(f"❌ KRITIKUS IMPORT HIBA: {e}")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"❌ VÁRATLAN HIBA: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
# Metadata kinyerése
|
||||
metadata_tables = Base.metadata.tables
|
||||
|
||||
print(f"📊 Összesen talált táblák száma a memóriában: {len(metadata_tables)}")
|
||||
|
||||
if len(metadata_tables) == 0:
|
||||
print("⚠️ VESZÉLY: A Metadata ÜRES! Az Alembic ezért nem lát semmit.")
|
||||
print("Ellenőrizd, hogy a modellek valóban az 'app.database.Base'-ből örökölnek-e!")
|
||||
else:
|
||||
# Csoportosítás sémák szerint a jobb átláthatóságért
|
||||
schemas = {}
|
||||
for table_full_name in metadata_tables:
|
||||
table_obj = metadata_tables[table_full_name]
|
||||
schema = table_obj.schema or "public"
|
||||
if schema not in schemas:
|
||||
schemas[schema] = []
|
||||
schemas[schema].append(table_full_name)
|
||||
|
||||
for schema in sorted(schemas.keys()):
|
||||
print(f"\n--- 📂 Séma: {schema} ({len(schemas[schema])} tábla) ---")
|
||||
for table in sorted(schemas[schema]):
|
||||
print(f" [✓] {table}")
|
||||
|
||||
print("\n🚀 Diagnosztika vége.")
|
||||
Reference in New Issue
Block a user