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.

fix(devex): keep deleted migrations out of the SQL report env (#113041)

Julian Bezedb6072254e1
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index 6a137263893a..934fbd6861c0 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -417,7 +417,9 @@ jobs:
timing_scripts: ${{ fromJSON(toJSON(steps.filter.outputs)).timing_scripts }}
backend_files: ${{ steps.filter.outputs.backend_files }}
migrations: ${{ steps.filter.outputs.migrations || 'true' }}
- migrations_files: ${{ steps.filter.outputs.migrations_files }}
+ # Added and modified files only. A squash retirement deletes thousands of
+ # migrations, and a step env string over 128 KiB fails the spawn (E2BIG).
+ migrations_review_files: ${{ steps.filter.outputs.migrations_review_files }}
migrations_any: ${{ steps.filter.outputs.migrations_any || 'true' }}
# What the replay gate in check-migrations keys off. A ClickHouse or
# async-migration change does not pay for a replay of a history the Django
@@ -655,6 +657,10 @@ jobs:
# depot strips canonical's separate persons-migration job
- 'rust/persons_migrations/*.sql'
- 'rust/bin/migrate-persons'
+ migrations_review:
+ - added|modified: 'posthog/migrations/*.py'
+ - added|modified: 'products/*/backend/migrations/*.py'
+ - added|modified: 'products/*/migrations/*.py'
# Any migration file in any app (broader than `migrations` above,
# which omits ee/ and posthog sub-package dirs). Gates the
# deleted-migration check in repo-checks.
@@ -2073,7 +2079,7 @@ jobs:
if: github.event_name == 'pull_request' && needs.changes.outputs.migrations == 'true'
env:
CI_REPORT_TOKEN: ${{ steps.ci-report.outputs.available == 'true' && steps.ci-report-app-token.outputs.token || '' }}
- CHANGED_FILES: ${{ needs.changes.outputs.migrations_files }}
+ CHANGED_FILES: ${{ needs.changes.outputs.migrations_review_files }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
# The PR checkout above uses the PR branch, which on unrebased PRs
@@ -2459,8 +2465,6 @@ jobs:
- name: Check migrations
# Skip migration safety check on master push (no migration_files from path filter)
if: github.event_name != 'push'
- env:
- MIGRATIONS_FILES: ${{ needs.changes.outputs.migrations_files }}
run: |
DATABASE_URL="postgres://posthog:posthog@localhost:5432/posthog_persons" \
sqlx migrate info --source rust/persons_migrations/
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index d1ccf40a5595..486c6718f609 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -150,7 +150,9 @@ jobs:
backend: ${{ contains(github.event.pull_request.labels.*.name, 'run-ci-backend') && 'true' || (steps.filter.outputs.backend || 'true') }}
backend_files: ${{ steps.filter.outputs.backend_files }}
migrations: ${{ steps.filter.outputs.migrations || 'true' }}
- migrations_files: ${{ steps.filter.outputs.migrations_files }}
+ # Added and modified files only. A squash retirement deletes thousands of
+ # migrations, and a step env string over 128 KiB fails the spawn (E2BIG).
+ migrations_review_files: ${{ steps.filter.outputs.migrations_review_files }}
migrations_any: ${{ steps.filter.outputs.migrations_any || 'true' }}
# What the replay gate in check-migrations keys off. A ClickHouse or
# async-migration change does not pay for a replay of a history the Django
@@ -391,6 +393,10 @@ jobs:
- 'posthog/migrations/*.py'
- 'products/*/backend/migrations/*.py'
- 'products/*/migrations/*.py' # Legacy structure
+ migrations_review:
+ - added|modified: 'posthog/migrations/*.py'
+ - added|modified: 'products/*/backend/migrations/*.py'
+ - added|modified: 'products/*/migrations/*.py'
# Any migration file in any app (broader than `migrations` above,
# which omits ee/ and posthog sub-package dirs). Gates the
# deleted-migration check in repo-checks.
@@ -1873,7 +1879,7 @@ jobs:
if: github.event_name == 'pull_request' && needs.changes.outputs.migrations == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- CHANGED_FILES: ${{ needs.changes.outputs.migrations_files }}
+ CHANGED_FILES: ${{ needs.changes.outputs.migrations_review_files }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
# The PR checkout above uses the PR branch, which on unrebased PRs
@@ -2285,8 +2291,6 @@ jobs:
- name: Check migrations
# Skip migration safety check on master push (no migration_files from path filter)
if: github.event_name != 'push'
- env:
- MIGRATIONS_FILES: ${{ needs.changes.outputs.migrations_files }}
run: |
DATABASE_URL="postgres://posthog:posthog@localhost:5432/posthog_persons" \
sqlx migrate info --source rust/persons_migrations/