Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): drop the node.js schema-restore fast path (#128435)

Georges-Antoine Assi982a60e2c50f
diff --git a/.github/workflows/ci-nodejs.yml b/.github/workflows/ci-nodejs.yml
index 3dbee6f305af..9fb3445843c1 100644
--- a/.github/workflows/ci-nodejs.yml
+++ b/.github/workflows/ci-nodejs.yml
@@ -614,57 +614,7 @@ jobs:
- name: Create Kafka topics
run: docker compose -f docker-compose.dev.yml up kafka-init
- - name: Fetch base branch for diff
- if: github.event_name == 'pull_request'
- env:
- BASE_REF: ${{ github.base_ref }}
- run: git fetch origin "$BASE_REF" --depth=1
-
- - name: Check for migrations in this PR
- id: check_migrations
- if: github.event_name == 'pull_request'
- env:
- BASE_REF: ${{ github.base_ref }}
- run: |
- if git diff --name-only "origin/$BASE_REF..HEAD" | grep -E '(migrations/|rust/.*migrate)'; then
- echo "has_migrations=true" >> $GITHUB_OUTPUT
- else
- echo "has_migrations=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Set up databases (fast path - restore schema)
- if: github.event_name == 'pull_request' && steps.check_migrations.outputs.has_migrations == 'false'
- env:
- TEST: 'true'
- SECRET_KEY: 'abcdef' # unsafe - for testing only
- DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog'
- BEHAVIORAL_COHORTS_DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/test_behavioral_cohorts'
- # Downloading an artifact requires the Actions permission, which the setup-actions app does not hold
- GH_TOKEN: ${{ github.token }}
- run: |
- # Download pre-migrated schema from CI
- ./bin/hogli db:download-schema
-
- # Create test databases
- docker compose -f docker-compose.dev.yml exec -T db psql -U posthog -c "DROP DATABASE IF EXISTS test_posthog;"
- docker compose -f docker-compose.dev.yml exec -T db psql -U posthog -c "CREATE DATABASE test_posthog;"
-
- # Restore schema to test database
- echo "Restoring schema to test_posthog database..."
- gunzip -c .postgres-backups/schema-latest.sql.gz | docker compose -f docker-compose.dev.yml exec -T db psql -q -U posthog test_posthog
- echo "✅ Schema restored"
-
- # Run Rust migrations for test databases
- cd nodejs && pnpm run setup:test:rust
-
- # Create dedicated persons database for postgres-parity tests
- pnpm run setup:test:persons-parity
-
- # Set up ClickHouse test database and schema
- cd .. && TEST=1 SECRET_KEY='abcdef' python manage.py setup_test_environment --only-clickhouse
-
- - name: Set up databases (slow path - run migrations)
- if: github.event_name != 'pull_request' || steps.check_migrations.outputs.has_migrations == 'true'
+ - name: Set up databases
env:
TEST: 'true'
SECRET_KEY: 'abcdef' # unsafe - for testing only
@@ -929,54 +879,7 @@ jobs:
- name: Create Kafka topics
run: docker compose -f docker-compose.dev.yml up kafka-init
- - name: Fetch base branch for diff
- if: github.event_name == 'pull_request'
- env:
- BASE_REF: ${{ github.base_ref }}
- run: git fetch origin "$BASE_REF" --depth=1
-
- - name: Check for migrations in this PR
- id: check_migrations
- if: github.event_name == 'pull_request'
- env:
- BASE_REF: ${{ github.base_ref }}
- run: |
- if git diff --name-only "origin/$BASE_REF..HEAD" | grep -E '(migrations/|rust/.*migrate)'; then
- echo "has_migrations=true" >> $GITHUB_OUTPUT
- else
- echo "has_migrations=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Set up databases (fast path - restore schema)
- if: github.event_name == 'pull_request' && steps.check_migrations.outputs.has_migrations == 'false'
- env:
- TEST: 'true'
- SECRET_KEY: 'abcdef' # unsafe - for testing only
- DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/posthog'
- BEHAVIORAL_COHORTS_DATABASE_URL: 'postgres://posthog:posthog@localhost:5432/test_behavioral_cohorts'
- # Downloading an artifact requires the Actions permission, which the setup-actions app does not hold
- GH_TOKEN: ${{ github.token }}
- run: |
- # Download pre-migrated schema from CI
- ./bin/hogli db:download-schema
-
- # Create test databases
- docker compose -f docker-compose.dev.yml exec -T db psql -U posthog -c "DROP DATABASE IF EXISTS test_posthog;"
- docker compose -f docker-compose.dev.yml exec -T db psql -U posthog -c "CREATE DATABASE test_posthog;"
-
- # Restore schema to test database
- echo "Restoring schema to test_posthog database..."
- gunzip -c .postgres-backups/schema-latest.sql.gz | docker compose -f docker-compose.dev.yml exec -T db psql -q -U posthog test_posthog
- echo "✅ Schema restored"
-
- # Run Rust migrations for test databases
- cd nodejs && pnpm run setup:test:rust
-
- # Set up ClickHouse test database and schema
- cd .. && TEST=1 SECRET_KEY='abcdef' python manage.py setup_test_environment --only-clickhouse
-
- - name: Set up databases (slow path - run migrations)
- if: github.event_name != 'pull_request' || steps.check_migrations.outputs.has_migrations == 'true'
+ - name: Set up databases
env:
TEST: 'true'
SECRET_KEY: 'abcdef' # unsafe - for testing only