Skip to content

Instantly share code, notes, and snippets.

@kneipp
Created February 25, 2012 00:53
Show Gist options
  • Save kneipp/1904980 to your computer and use it in GitHub Desktop.
Save kneipp/1904980 to your computer and use it in GitHub Desktop.
Bug ao usar south por uso errado (alterando mysql manualmente)
~/workspace/django/financeiro$ ./manage.py migrate
Running migrations for customers:
- Migrating forwards to 0001_initial.
> customers:0001_initial
! Error found during real run of migration! Aborting.
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
! You *might* be able to recover with: = DROP TABLE `customers_customer` CASCADE; []
= DROP TABLE `customers_contact` CASCADE; []
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS.
! NOTE: The error which caused the migration to fail is further up.
Traceback (most recent call last):
File "./manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/south/management/commands/migrate.py", line 105, in handle
ignore_ghosts = ignore_ghosts,
File "/Library/Python/2.7/site-packages/south/migration/__init__.py", line 191, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 221, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 292, in migrate_many
result = self.migrate(migration, database)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 125, in migrate
result = self.run(migration)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 99, in run
return self.run_migration(migration)
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 81, in run_migration
migration_function()
File "/Library/Python/2.7/site-packages/south/migration/migrators.py", line 57, in <lambda>
return (lambda: direction(orm))
File "/Users/kneipp/workspace/django/financeiro/app/customers/migrations/0001_initial.py", line 28, in forwards
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
File "/Library/Python/2.7/site-packages/south/db/generic.py", line 226, in create_table
', '.join([col for col in columns if col]),
File "/Library/Python/2.7/site-packages/south/db/generic.py", line 150, in execute
cursor.execute(sql, params)
File "/Library/Python/2.7/site-packages/django/db/backends/util.py", line 34, in execute
return self.cursor.execute(sql, params)
File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/Library/Python/2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/Library/Python/2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1050, "Table 'customers_customer' already exists")
~/workspace/django/financeiro$
@kneipp
Copy link
Author

kneipp commented Feb 25, 2012

Erro apresentado ao utilizar o south + mysql 5.5.15
Após atualizar o mysql para 5.5.19, dropar o bd, fazer um sync + ./manage.py migrate funcionou.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment