Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python manage.py migrate failed #32

Closed
BladeSmithJohn opened this issue Feb 3, 2017 · 2 comments
Closed

python manage.py migrate failed #32

BladeSmithJohn opened this issue Feb 3, 2017 · 2 comments

Comments

@BladeSmithJohn
Copy link

Operations to perform:
Apply all migrations: admin, app_search, auth, captcha, contenttypes, sessions, social_django
Running migrations:
Applying social_django.0005_auto_20160727_2333...Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management_init_.py", line 367, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management_init_.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 345, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\migrate.py", line 204, in handle
fake_initial=fake_initial,
File "C:\Python27\lib\site-packages\django\db\migrations\executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "C:\Python27\lib\site-packages\django\db\migrations\executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "C:\Python27\lib\site-packages\django\db\migrations\executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Python27\lib\site-packages\django\db\migrations\migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Python27\lib\site-packages\django\db\migrations\operations\models.py", line 532, in database_forwards
getattr(new_model._meta, self.option_name, set()),
File "C:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 333, in alter_unique_together
self.execute(self._create_unique_sql(model, columns))
File "C:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 112, in execute
cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\utils.py", line 94, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python27\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 110, in execute
return self.cursor.execute(query, args)
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 201, in execute
self.errorhandler(self, exc, value)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 1000 bytes')

@omab
Copy link
Contributor

omab commented Feb 4, 2017

Check the docs https://python-social-auth.readthedocs.io/en/latest/configuration/settings.html#tweaking-some-fields-length

@omab omab closed this as completed Feb 4, 2017
@thismatters
Copy link

For others who encounter this issue. After setting the lengths as mentioned in the docs it might be necessary to roll back all migrations for the app since those constants are referenced in the initial migration.

To roll back the migrations use: python manage.py migrate social_django zero

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

No branches or pull requests

3 participants