Using django-south, is it possible to setup a table only to the last, most recent configuration without applying all the preceeding migrations?
We are interested in using a 3rd party tool (django-activity-stream) but are having difficulties running all the migrations, for somewhat unknown reasons (possibly MySQL issues regarding a particular field) - specifically migration 003, which raises an error
_mysql_exceptions.OperationalError: (1170, "BLOB/TEXT column 'object_id' used in key specification without a key length") " I strongly suspect that avoiding the migrations and going straight to the current schema will avoid this.
The ability to migrate backwards is not required, only the need to get us to the current schema right now, and I don't want to hack the package to deal with this. I can't seem to establish the commands, or whether this is even possible?
config:
south 0.7.6, django 1.3.x, mysql 5.5.x, django-activity-stream 0.4.4
This error is coming because of the way actstream
handles its Generic Foreign keys. The problem arises with MySql because it sees text-fields without any
length specified.
This error can be fixed by making the migration 0003 a no-op.
Change the following things in migrations 0003_text_field_ids
, 0004_char_field_ids
in the actstream:
0003_text_field_ids.py:
def forwards(self, orm)
, def backwards(self, orm)
and just write pass
in both. TextField
to PositiveIntegerField
.0004_char_field_ids.py:
def backwards(self, orm)
, change TextField
to PositiveIntegerField
in all db.altercolumns()
.This makes migration 0003 a noop using pass for forwards and backwards and makes the model's definition use PositiveIntegerFields
for the Generic Foreign keys, so they're kept in the same state as migration 0001 left them. Doing this, migration 0004 can pick up from the PositiveIntegerFields
to varChars
. Then the fix changes migration 0004 so the backward migration changes to PositiveIntegerFields
instead of TextFields
.
This should hopefully fix your issue.