Skip to content

Make migrations robust #5227

@grantfitzsimmons

Description

@grantfitzsimmons

Migrations are failing quite regularly, and the user is often not notified of the failure until the app tries to access a particular field/table that is not available to it.

This manifests in errors such as the common
Unknown column 'spmerging.status' in 'field list

This issue is due to the the original migration using the field name mergingstatus:

('mergingstatus', models.CharField(max_length=256)),

Later, we changed the name of this field (among others) to status:

migrations.RenameField(
model_name='spmerging',
old_name='mergingstatus',
new_name='status',
),

If any migrations between the two fail (so a particular table doesn't exist or another migration was not run), it fails silently.

Jul 24 16:14:30 lsa-spcfy1-d docker/s795-sb-specify7-sb-1[1439]: MySQLdb.OperationalError: (1050, "Table 'spmerging' already exists") Jul 24 16:14:30

Reported By: SAIAB, KU, UT Austin, Cal Academy

Metadata

Metadata

Assignees

No one assigned

    Labels

    1 - BugIncorrect behavior of the product1 - EnhancementImprovements or extensions to existing behavior

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions