fix: fail closed on bootstrap migration inspection
This commit is contained in:
@@ -44,7 +44,10 @@ $compose run --rm --no-deps community-scheduler python -c "import app.community_
|
||||
echo "Community scheduler valid ✓"
|
||||
|
||||
# A10: Extract Alembic revision ID programmatically, handle multiple heads
|
||||
ALEMBIC_HEADS_OUTPUT=$($compose exec -T api alembic heads 2>/dev/null || true)
|
||||
if ! ALEMBIC_HEADS_OUTPUT=$($compose exec -T api alembic heads 2>/dev/null); then
|
||||
echo "ERROR: unable to read Alembic heads" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Extract revision IDs (first field before space or '(head)'), handle multiple heads
|
||||
ALEMBIC_HEAD=$(echo "$ALEMBIC_HEADS_OUTPUT" | grep -oE '^[a-f0-9]+' | head -1)
|
||||
DB_VERSION=$($compose exec -T db psql -At -U rf4 -d rf4_spotter -c 'select version_num from alembic_version')
|
||||
@@ -60,7 +63,7 @@ if [ -z "$DB_VERSION" ]; then
|
||||
fi
|
||||
|
||||
# Handle multiple heads: check if DB version matches any head
|
||||
HEAD_COUNT=$(echo "$ALEMBIC_HEADS_OUTPUT" | grep -cE '^[a-f0-9]+' || true)
|
||||
HEAD_COUNT=$(echo "$ALEMBIC_HEADS_OUTPUT" | grep -cE '^[a-f0-9]+') || HEAD_COUNT=0
|
||||
if [ "$HEAD_COUNT" -gt 1 ]; then
|
||||
echo "WARNING: Multiple Alembic heads detected ($HEAD_COUNT), checking if DB version matches any..."
|
||||
if ! echo "$ALEMBIC_HEADS_OUTPUT" | grep -q "^$DB_VERSION"; then
|
||||
|
||||
Reference in New Issue
Block a user