Modify ↓
Ticket #281 (closed defect: fixed)
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: |
Description
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'])
db.delete_table('localsite_oldmodel')
def backwards(self, orm):
db.delete_table('localsite_newmodel')
db.create_table('localsite_oldmodel', (
('bar', orm['localsite.newmodel:bar']), # <=====
('id', orm['localsite.newmodel:id']), # <=====
))
db.send_create_signal('localsite', ['oldmodel'])
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

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.