首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >应用auth.0008_alter_user_username_max_length...Traceback (最近一次调用),django mssql后端迁移错误

应用auth.0008_alter_user_username_max_length...Traceback (最近一次调用),django mssql后端迁移错误
EN

Stack Overflow用户
提问于 2020-08-07 20:25:51
回答 1查看 733关注 0票数 0

我使用django 3.1的最新版本,使用django-mssql-backend来迁移mssql数据库,当我尝试迁移时遇到了这个问题: auth.0008_alter_user_username_max_length...Traceback (最近调用的最后一个);

代码语言:javascript
复制
   Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length...Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\core\management\base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\core\management\base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\core\management\commands\migrate.py", line 245, in handle
    fake_initial=fake_initial,
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\migrations\migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\migrations\operations\fields.py", line 236, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\backends\base\schema.py", line 572, in alter_field
    old_db_params, new_db_params, strict)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\sql_server\pyodbc\schema.py", line 479, in _alter_field
    self.execute(self._create_unique_sql(model, columns=[old_field.column]))
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\sql_server\pyodbc\schema.py", line 861, in execute
    sql = str(sql)
  File "C:\Users\Leo\PycharmProjects\Django\untitled\venv\lib\site-packages\django\db\backends\ddl_references.py", line 200, in __str__
    return self.template % self.parts
KeyError: 'deferrable'
EN

回答 1

Stack Overflow用户

发布于 2020-08-07 20:43:21

我知道这不是解决之道。但我之前也遇到过类似的问题。为了解决这个问题,我回滚到Django 3.0.x,然后运行迁移。

希望本文也能对您有所帮助:)

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63301860

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档