Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#21280 closed Bug (fixed)

Avoid generating empty migrations on serialization failures

Reported by: timo 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


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.

Attachments (0)

Change History (3)

comment:1 Changed 9 months ago by tuxcanfly

comment:2 Changed 9 months ago by Tim Graham <timograham@…>

  • Owner set to Tim Graham <timograham@…>
  • Resolution set to fixed
  • Status changed from new to closed

In a921f0634583e2f87475e802e2674e7159b4f25b:

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

comment:3 Changed 9 months 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.