Ticket #395 (closed defect: invalid)

Opened 5 years ago

Last modified 18 months ago

forwards()/backwards() should have access to old/new orm

Reported by: rctay89@… Owned by: andrew
Priority: major Milestone: 0.7.1
Component: commands Version: 0.7-rc1
Keywords: Cc:


I do see a prev_orm()/next_orm() method, but as far as I can see, they can't be accessed from forwards()/backwards().

Change History

comment:1 Changed 5 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone set to 0.7.1

I don't see what the use case is here - forwards/backwards already get passed an ORM in their parameters, and there should be no concept of a previous/next ORM in data migrations, as there are no schema changes.

comment:2 Changed 5 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to invalid

comment:3 Changed 18 months ago by yurii.zolotko@…

Example usage is to move data from one table(s) to another in a single action. Spliting this action into 3 (create new table schema migration, copy data migration, delete original tables schema migration) leaves database in inconsistent state twice. Also it requires to copy-paste models to make both old and new versions accessible during single migration. If there would be access to previous ORM one could just rename and adjust model in models.py and copy from old tables with old models to new tables with new models.

Method suggested at http://south.readthedocs.org/en/latest/tutorial/part3.html is ugly as such migration should be atomic especially when it comes to merging or otherwise modifying multiple tables at once.

Note: See TracTickets for help on using tickets.