"""PostgreSQL + pgvector + migration 상태. verify.sh 가 web 컨테이너 stdin 으로 넣는다.""" import os import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alpha.settings") django.setup() from django.db import connection # noqa: E402 with connection.cursor() as c: c.execute("SELECT version()") print("VER=%s" % c.fetchone()[0].split(",")[0]) c.execute("SELECT extversion FROM pg_extension WHERE extname='vector'") row = c.fetchone() print("VECTOR=%s" % (row[0] if row else "MISSING")) c.execute("SELECT count(*) FROM django_migrations") print("MIGRATIONS=%s" % c.fetchone()[0]) c.execute("SELECT count(*) FROM information_schema.tables WHERE table_schema='public'") print("TABLES=%s" % c.fetchone()[0])