は(0002_logentry_remove_auto_add)私はエラーを取得する:ジャンゴ(42000):管理者移行を実行しようとすると「action_time」の無効なデフォルト値は
これを引き起こしているのかわからmysql.connector.errors.ProgrammingError: 1067 (42000): Invalid default value for 'action_time'
ない、私はソースコンパイルされたバージョンを持っていますmysql(5.5.50)には何か関係があります。ジャンゴを実行
は、MySQLコネクタ - のpythonで1.9.2 2.1.3
編集トレースバック:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 200, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/migrations/executor.py", line 92, in migrate
self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/migrations/executor.py", line 121, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/migrations/executor.py", line 198, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/migrations/migration.py", line 123, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 201, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 482, in alter_field
old_db_params, new_db_params, strict)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 634, in _alter_field
params,
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 110, in execute
cursor.execute(sql, params)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/mysql/connector/django/base.py", line 227, in execute
return self._execute_wrapper(self.cursor.execute, query, new_args)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/mysql/connector/django/base.py", line 180, in _execute_wrapper
utils.ProgrammingError(err.msg), sys.exc_info()[2])
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/mysql/connector/django/base.py", line 177, in _execute_wrapper
return method(query, args)
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/mysql/connector/cursor.py", line 515, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/mysql/connector/connection.py", line 488, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "/home/bischoff_s/Code/venvs/gec/lib/python3.5/site-packages/mysql/connector/connection.py", line 395, in _handle_result
raise errors.get_exception(packet)
django.db.utils.ProgrammingError: Invalid default value for 'action_time'
編集の詳細:
ipdb> stmt
b"ALTER TABLE `django_admin_log` ALTER COLUMN `action_time` SET DEFAULT '2016-07-25 17:58:03.214262+00:00'"
ipdb> self._connection.cmd_query(stmt)
*** mysql.connector.errors.ProgrammingError: 1067 (42000): Invalid default value for 'action_time'
私は、データベースがある理由はわかりませんこのデータを有効なデフォルト値として取り込まないでください。
timezone.nowですが、これはdjango(adminモデル)に付属するデフォルトの移行です – bischoffingston
Djangoはデータベースにデフォルト値を設定しないため、何か変わったことがあります。フルトレースバックを表示してください。 –
移行でデフォルトのキーワードがある場合、djangoはどのようにデフォルトに設定されませんか?何か不足していますか? – bischoffingston