djangoでmigrateした時にでた以下のエラーがよくわかりません。
python
1Traceback (most recent call last): 2 File "manage.py", line 10, in <module> 3 execute_from_command_line(sys.argv) 4 File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line 5 utility.execute() 6 7---省略--- 8 9 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 484, in alter_field 10 old_db_params, new_db_params, strict) 11 File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 557, in _alter_field 12 fragment, other_actions = self._alter_column_type_sql(model._meta.db_table, new_field.column, new_type) 13TypeError: _alter_column_type_sql() missing 1 required positional argument: 'new_type'
TypeErrorで'new_type'が足りていないと言われてるんだろうなと思うのですが、
ここに表記される変数名は、呼び出し時の変数名ではなく、関数定義時の変数名のはずでは...?と混乱しています。
というかそもそも、渡している値が足りないということもなさそうですし...。
なぜこのエラーが出るのでしょう?見当もつかず困っています。
ちなみに、_alter_column_type_sqlの定義は以下のようにされています。
python
1def _alter_column_type_sql(self, table, column, type):¬ 2 return (¬ 3 (¬ 4 self.sql_alter_column_type % {¬ 5 "column": self.quote_name(column),¬ 6 "type": type,¬ 7 },¬ 8 [],¬ 9 ),¬ 10 [],¬ 11 )
また、557行目の呼び出しは以下のようにされています。
python
1if old_type != new_type: 2 fragment, other_actions = self._alter_column_type_sql(model._meta.db_table, new_field.column, new_type) 3 actions.append(fragment) 4 post_actions.extend(other_actions)
あなたの回答
tips
プレビュー