Ticket #281 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

Anomaly when startmigration --auto adds one and removes another model

Reported by: Erik Allik <eallik@…> Owned by: andrew
Priority: major Milestone: 0.7
Component: commands Version: 0.6.2
Keywords: startmigration Cc:


I created an --auto migration which deleted an existing model ExistingModel and added a new model NewModel, but the weird thing is that, in the backwards method of the migration, the ExistingModel model is recreated as expected, but with field definitions referencing orm['appname.newmodel:fieldname'] instead of the expected orm['appname.existingmodel:fieldname']. Here are the relevant parts of the migration:

    def forwards(self, orm):
        db.create_table('localsite_newmodel', (
            ('id', orm['localsite.newmodel:id']),
            ('foo', orm['localsite.newmodel:foo']),
        db.send_create_signal('localsite', ['NewModel'])
    def backwards(self, orm):
        db.create_table('localsite_oldmodel', (
            ('bar', orm['localsite.newmodel:bar']), # <=====
            ('id', orm['localsite.newmodel:id']),   # <=====
        db.send_create_signal('localsite', ['oldmodel'])

Change History

comment:1 Changed 6 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7

Ah, yes, this is one of those issues where the automigrator wasn't written entirely properly; I knew something like this would crop up eventually. This entire system is being rewritten as part of 0.7, so it'll be fixed there.

comment:2 Changed 6 years ago by ed@…

Able to reproduce here too.

comment:3 Changed 6 years ago by andrew

  • Status changed from assigned to closed
  • Resolution set to fixed

I can't replicate this with 0.7, so marking as fixed.

Note: See TracTickets for help on using tickets.