Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stuck in a django south migration - TransactionManagement error

I am having a trouble when applying a django south migration:

As always, I executed the migrate command after a successful schemamigration

python manage.py migrate webapp

The log console:

Running migrations for webapp:
 - Migrating forwards to 0020_auto__add_example.
 > webapp:0020_auto__add_example
TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK

The error is not related with the specific migration as if I move backwards and try another it shows the same message.

Edit. This is the log of the query:

(0.005) SELECT `south_migrationhistory`.`id`, `south_migrationhistory`.`app_name`, `south_migrationhistory`.`migration`, `south_migrationhistory`.`applied` FROM `south_migrationhistory` WHERE `south_migrationhistory`.`applied` IS NOT NULL ORDER BY `south_migrationhistory`.`applied` ASC; args=()
Running migrations for webapp:
 - Migrating forwards to 0020_auto__add_example.
 > webapp:0020_auto__add_example
(0.002) CREATE TABLE ROLLBACK_TEST (X INT); args=()
TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK
like image 838
Miquel Avatar asked Aug 26 '13 10:08

Miquel


People also ask

What is South migration in Django?

South is a migration tool used with Django. There will be times when you would be adding fields to a model or changing the type of field (eg: Field was an IntegerField and you want to change it to FloatField). In such cases syncdb doesn't help and South comes to your rescue.


1 Answers

I just ran into a similar issue.

  • MySQL 5.6.13 (on Amazon RDS)
  • Django==1.5.4
  • MySQL-python==1.2.4
  • South==0.8.2

I went through almost every possible fix here and through countless Google searches with zero luck.

I looked at the database schema and a table I had not created named 'ROLLBACK_TEST' was part of the schema.

Once I dropped that mystery table the migration ran flawlessly.

This table could only have originated via Django, South or possibly an internal process at Amazon as nothing else has access.

like image 189
Chris Hayes Avatar answered Nov 15 '22 11:11

Chris Hayes