Skip to content

[Task]: Force migrations that execute python code to run on primary database #16069

@diox

Description

@diox

Description

Database migrations that use RunPython use the regular database routing rules, which means reads to to the replica.

So you can create a situation where a migration adds some data, then the following migration after that attempts to read that data and fails because it's using the replica which doesn't have it yet.

We would try to monkeypatch RunPython to force the primary db to be used, or have our own function that does it and force us to use it instead of the original through some linting.

See also #15559

Acceptance Criteria

  • RunPython migrations use the primary db somehow

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions