Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .superset/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -euo pipefail

RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down Expand Up @@ -36,9 +36,10 @@ WORKSPACE_NAME="${SUPERSET_WORKSPACE_NAME:-$(basename "$PWD")}"
NEON_OUTPUT=$(neonctl branches create \
--project-id tiny-cherry-82420694 \
--name "$WORKSPACE_NAME" \
--output json 2>&1 | grep -v "^WARNING:")
--output json)

# Parse connection strings from create output
BRANCH_ID=$(echo "$NEON_OUTPUT" | jq -r '.branch.id')
DATABASE_URL=$(echo "$NEON_OUTPUT" | jq -r '.connection_uris[0].connection_uri')
POOLER_HOST=$(echo "$NEON_OUTPUT" | jq -r '.connection_uris[0].connection_parameters.pooler_host')
PASSWORD=$(echo "$NEON_OUTPUT" | jq -r '.connection_uris[0].connection_parameters.password')
Expand All @@ -47,6 +48,7 @@ DATABASE=$(echo "$NEON_OUTPUT" | jq -r '.connection_uris[0].connection_parameter
DATABASE_POOLED_URL="postgresql://${ROLE}:${PASSWORD}@${POOLER_HOST}/${DATABASE}?sslmode=require"

cat > .env << EOF
NEON_BRANCH_ID=$BRANCH_ID
DATABASE_URL=$DATABASE_URL
DATABASE_POOLED_URL=$DATABASE_POOLED_URL
EOF
Expand Down
16 changes: 12 additions & 4 deletions .superset/teardown.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -euo pipefail

RED='\033[0;31m'
GREEN='\033[0;32m'
Expand All @@ -15,12 +15,20 @@ command -v neonctl &> /dev/null || error "Neon CLI not installed. Run: npm insta

# Delete Neon branch for this workspace
WORKSPACE_NAME="${SUPERSET_WORKSPACE_NAME:-$(basename "$PWD")}"
if [ -f ".env" ]; then
# shellcheck disable=SC1091
source .env
fi
BRANCH_ID="${NEON_BRANCH_ID:-}"
if [ -z "$BRANCH_ID" ]; then
error "No NEON_BRANCH_ID found in .env; cannot delete branch"
fi

echo "🗄️ Deleting Neon branch: $WORKSPACE_NAME"
if neonctl branches delete "$WORKSPACE_NAME" --project-id tiny-cherry-82420694 --force 2>/dev/null; then
echo "🗄️ Deleting Neon branch: $WORKSPACE_NAME ($BRANCH_ID)"
if neonctl branches delete "$BRANCH_ID" --project-id tiny-cherry-82420694 --force 2>/dev/null; then
success "Neon branch deleted: $WORKSPACE_NAME"
else
echo "⚠️ Neon branch '$WORKSPACE_NAME' not found or already deleted"
echo "⚠️ Neon branch '$WORKSPACE_NAME' ($BRANCH_ID) not found or already deleted"
fi

echo "✨ Teardown complete!"