Reputation: 3236
I have just upgraded to Django 1.7 and I have some issues with some of my migrations. Before upgrading I used South to handle data migrations and one migration I had was to alter the field length for the name field in auth_permissions.
How can I write the same migration using django migrations >= 1.7?
Upvotes: 2
Views: 614
Reputation: 16
having problem with permission name length using Django 1.8 Python 3.4.4 (these are the latest versions that MySQL 5.6+ works with) changed the base\schema.py
in _alter_field(...)
# ********* altered - start
fragment, other_actions = self._alter_column_type_sql(table=model._meta.db_table, old_field=old_field, new_field=new_field.column, new_type=new_type)
# ******** end
changed the definition to:
def _alter_column_type_sql(self, table, old_column, column, type):
That's it. All the migration works
Upvotes: 0
Reputation: 1387
Is that change still required? The length of that field was a known issue for a long time, but the most recent update in the bug tracker says it was quintupled in length.
If you still want it to be even longer, you probably want this.
EDIT: Giving up on this for now. Writing a migration that is stored in app A but applied to app B involves deeper monkeying than I have time for.
Suggested routes:
Use RunSQL in a migration within one of your own apps to tweak the field by hand.
Fork Django 1.7.8, add the auth migration described in the comments, pip install against that github repo.
Use Django 1.8, where this change is standard.
Upvotes: 1