Error when i try to run migrate for my model

148 views
Skip to first unread message

ndu sunday

unread,
Jan 15, 2018, 11:06:40 AM1/15/18
to Django users
When i run migrate i encouter datatype mismatch error. Below is the complete information i got, what could be wrong and how do i resolve it?


Applying catalog.0006_auto_20180113_1923...Traceback (most recent call last):
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.IntegrityError: datatype mismatch

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/ndu/.local/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 200, in handle
    fake_initial=fake_initial,
  File "/home/ndu/.local/lib/python3.5/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 "/home/ndu/.local/lib/python3.5/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 "/home/ndu/.local/lib/python3.5/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/migrations/migration.py", line 122, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 216, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py", line 114, in alter_field
    super().alter_field(model, old_field, new_field, strict=strict)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 509, in alter_field
    old_db_params, new_db_params, strict)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py", line 311, in _alter_field
    self._remake_table(model, alter_field=(old_field, new_field))
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py", line 252, in _remake_table
    self.quote_name(model._meta.db_table),
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 117, in execute
    cursor.execute(sql, params)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/ndu/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 303, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: datatype mismatch


Jason

unread,
Jan 15, 2018, 12:12:45 PM1/15/18
to Django users
show your models.  This is something dealing with sqlite, so we'll have to see what your models are
Reply all
Reply to author
Forward
0 new messages