Sunday, December 21, 2014

How to make a migration irreversible [1.7]

Hi,

I need to make a migration irreversible. And strangely I don't see any way to do it in the migration doc. I see that the Operation class has a property called `reversible`, but don't see any way to set it to False.

I had a legacy model that was generated with inspectdb, hence it had managed=False. But now when I Need to make changes to it I removed the managed flag and the migration is trying to delete the table and create it again. I removed the droptable operation and faked the migration to avoid the error. But if I revert the migration, that table is going to be dropped anyway, right? Because it's the revert operation of CreateTable. How do I stop the backward migration for this particular migration? There is nothing much important before it, so it's not a trouble if it's irreversible.

Am I missing something really obvious?

Thanks,
Bibhas

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e8baa60e-606b-4a59-88c1-1c136c700e8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment