Problem applying Migrations 24 and 25
arghhh
Trying to migrate from 0.6.17 to 0.6.48 - Straight environment - mysql backend
UPDATE:
I have updated to the latest version, and migration 24 now works. However, 25 still fails.
I've decided to delve more deeply in this, and here is my findings:
There are some issues in the migration itself:
xxx> python manage.py migrate askbot Running migrations for askbot: - Migrating forwards to 0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d. > askbot:0025_transfer_flagged_items_to_activity - Migration 'askbot:0025_transfer_flagged_items_to_activity' is marked for no-dry-run. ! Error found during real run of migration! Aborting. ... File "...askbot/migrations/0025_transfer_flagged_items_to_activity.py", line 35, in forwards assert(activity.content_type==flag.content_type) File "...django/db/models/fields/related.py", line 244, in __get__ raise self.field.rel.to.DoesNotExist
Issue 1:
Line 35: assert(activity.content_type==flag.content_type)
The tables activity and flagged_item don't have content_type field. They have "content_type_id" fields. Same with user vs. user_id, but that one doesn't complain.
Issue 2:
Once that was fixed, I ran into the assertion failure where content type is different!
Here is the entire flagged_item table:
mysql> select * from flagged_item; +-----------+---------------------+----+-----------------+---------+ | object_id | flagged_at | id | content_type_id | user_id | | 166 | 2010-11-01 15:55:02 | 1 | 21 | 10 | +-----------+---------------------+----+-----------------+---------+ mysql> select * from activity where object_id=166; | is_audited | object_id | user_id | content_type_id | active_at | id | activity_type | question_id | +--------------------------------------------------------------------------------------------------------+ | 0 | 166 | 3 | 26 | 2010-10-28 12:| 432 | 2 | 155 | | 0 | 166 | 3 | 21 | 2010-10-28 16:| 458 | 1 | 166 | +--------------------------------------------------------------------------------------------------------+
There seems to be some data inconsistency:
- User Id in the Flagged_item and the activity table is different, so that assert should fail no?
- Same object_id for 2 activity entries, but the question_id are different - note that 1 question is flagged, and 1 answer is also flagged (to the same question). Is this an edge case I'm running into?
Comments