Skip to content

Conversation

@chromy
Copy link
Contributor

@chromy chromy commented Oct 28, 2025

The 1000th migration (https://github.com/getsentry/sentry/pull/102006)

Suffered from a CI error:

django.db.migrations.exceptions.NodeNotFoundError: Migration sentry.1000_add_project_distribution_scope dependencies reference nonexistent parent node ('sentry', '0999_add_extrapolation_mode_to_snuba_query')
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/runner/work/sentry/sentry/tools/migrations/squash.py", line 293, in <module>
    raise SystemExit(main())
                     ~~~~^^
  File "/home/runner/work/sentry/sentry/tools/migrations/squash.py", line 282, in main
    subprocess.check_call(cmd, stdout=subprocess.DEVNULL)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('sentry', 'django', 'makemigrations', '-n', 'squash')' returned non-zero exit status 1.

Where we could not find the parent migration: 0999_add_extrapolation_mode_to_snuba_query
This turned out to be due to the code which finds migrations expecting them to begin with a 0:

def _migrations(root: str) -> Generator[str]:
    for fname in os.listdir(root):
        if fname.startswith("0") and fname.endswith(".py"):
            yield fname

Change this to allow migrations to begin with any digit.

@chromy chromy requested a review from a team as a code owner October 28, 2025 12:24
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 28, 2025
@runningcode
Copy link
Contributor

Thanks!

@chromy chromy closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants