Skip to content

Give autogenerated migrations sequential numbers #634

Description

@chetanr25

Give autogenerated migrations sequential numbers

Right now make migration msg="..." lets Alembic pick the revision id, so every new file lands with a random hash prefix like 621bb06ff5d1_...py. The first two migrations are numbered 001_ and 002_, so the folder mixes two styles and you can't tell the order of revisions by looking at the file names.

Scope

  • Update the migration target so it takes a rev argument and passes it to Alembic as --rev-id. Alembic's default file name is <rev>_<slug>.py, so a numbered rev makes the file land in order (for example 003_...py).
  • Make rev required, with a short usage hint when it is missing.
  • Note the workflow in the docs: bump to the next number, zero-padded to three digits.

Example:

make migration rev=0xx msg="<migration message>"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions