Django migrations operations inside RunPython code
I’m working with data migrations in django, and at some point, I’ll have to run migrations.RunPython. The point is that I wish I could execute migrations operations(AddField, AlterField) under certain conditions.
removing data migrations in Django
I have been working on a Django app for a client. throughout development there have been data migrations (data insertions/modifications, not structural changes) that have been specific to the client. I am now working on bringing on other clients to use the same app, so I want all reminents of the client specific data removed from the migration files. I feel like the safe and simple way is to keep those migration files and just erase the data migration operations logic. I dont see any reason to keep the data migration logic around anyways, even for the initial client, as it has already been tested and applied in their production environment a while ago. My question: Is this solution sound or are there other points that should be considered?
Django: Maintaining a local set of migrations differing from upstream
I have written patches for a Django project that take forever to be integrated upstream (or may not even be). Due to this, I have local migrations that I need to maintain.
However, due to the way the migration numbering system works, I have to update their numbers everytime upstream adds a new migrations, and that doesn’t even work properly as it creates conflicts with the database state.
django.db.utils.OperationalError: no such column: media_mediamodule.article_pill
**Just to be clear, I have read all other articles on and they’re all a billion years ago and Django has made several revisions since these posts were posted. **