Ticket #67 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

--add-field for m2m fields generates invalid code

Reported by: eallik@… Owned by: andrew
Priority: major Milestone: 0.4
Component: commands Version: 0.6-pre
Keywords: Cc: eallik@…


When doing startmigration appname --add-field MyModel?.field, the migration that gets generated has the following code in its backwards method:

db.delete_column('myapp_mymodel', 'field')

which is invalid because 'field' is not an actual field in the database. The command should either generate working code, or the semantics of db.delete_column could be changed to accommodate this behavior.

Change History

comment:1 Changed 7 years ago by andrew

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

Fixed in [122]. (The forwards side was also useless, since you need to manually create tables).

Also, note one of the answers in the FAQ; if you're using through=, then use --model, not --add-field.

Note: See TracTickets for help on using tickets.