Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21280 closed Bug (fixed)

Avoid generating empty migrations on serialization failures

Reported by: Tim Graham Owned by: Tim Graham <timograham@…>
Component: Migrations Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If a model fails to serialize, an empty migration file will be generated which needs to be removed manually. You'll get an error like "django.db.migrations.loader.BadMigrationError: Migration 0001_initial in app auth has no Migration class" if you try to migrate without doing so.

We should either verify that there won't be any errors before creating the migration file or remove the empty file if there is an error.

Change History (3)

comment:1 Changed 3 years ago by tuxcanfly

comment:2 Changed 3 years ago by Tim Graham <timograham@…>

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In a921f0634583e2f87475e802e2674e7159b4f25b:

Fixed #21280 -- Don't generate empty migration files

comment:3 Changed 3 years ago by Tim Graham <timograham@…>

In 50087063450b3134461f2c4c5a36c3dd8ec1980c:

Added test for a921f06 - refs #21280.

This commit also lays the groundwork for future tests for the
makemigrations command.

Note: See TracTickets for help on using tickets.
Back to Top