Django migrate hatası

WARNINGS:
?: (ckeditor.W001) django-ckeditor bundles CKEditor 4.22.1 which isn’t supported anmyore and which does have unfixed security issues, see for example CKEditor 4.24.0 LTS | CKEditor.com . You should consider strongly switching to a different editor (maybe CKEditor 5 respectively django-ckeditor-5 after checking whether the CKEditor 5 license terms work for you) or switch to the non-free CKEditor 4 LTS package. See CKEditor 4 | Visual Text Editor for HTML for more on this. (Note! This notice has been added by the django-ckeditor developers and we are not affiliated with CKSource and were not involved in the licensing change, so please refrain from complaining to us. Thanks.)
Operations to perform:
Apply all migrations: accounts, admin, auth, contenttypes, sessions
Running migrations:
Applying accounts.0013_blogcategories_slug…Traceback (most recent call last):
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\utils.py”, line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\sqlite3\base.py”, line 354, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.IntegrityError: UNIQUE constraint failed: new__accounts_blogcategories.slug

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

Traceback (most recent call last):
File “C:\DJANGO\pyblog\blog\manage.py”, line 22, in
main()
File “C:\DJANGO\pyblog\blog\manage.py”, line 18, in main
execute_from_command_line(sys.argv)
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\core\management_init_.py”, line 442, in execute_from_command_line
utility.execute()
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\core\management_init_.py”, line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\core\management\base.py”, line 413, in run_from_argv
self.execute(*args, **cmd_options)
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\core\management\base.py”, line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\core\management\base.py”, line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\core\management\commands\migrate.py”, line 357, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\migrations\executor.py”, line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\migrations\executor.py”, line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\migrations\executor.py”, line 255, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\migrations\migration.py”, line 132, in apply
operation.database_forwards(
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\migrations\operations\fields.py”, line 110, in database_forwards
schema_editor.add_field(
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\sqlite3\schema.py”, line 316, in add_field
self._remake_table(model, create_field=field)
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\sqlite3\schema.py”, line 246, in _remake_table
self.execute(
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\base\schema.py”, line 202, in execute
cursor.execute(sql, params)
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\utils.py”, line 122, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\utils.py”, line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\utils.py”, line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\utils.py”, line 100, in _execute
with self.db.wrap_database_errors:
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\utils.py”, line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\utils.py”, line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\DJANGO\pyblog\venv\Lib\site-packages\django\db\backends\sqlite3\base.py”, line 354, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.IntegrityError: UNIQUE constraint failed: new__accounts_blogcategories.slug

biçiminde bir hata alıyorum

Benzersiz (UNIQ.) olarak tanımladığınız tablo alanları ile ilgili olabilir. Son kısımda geçersiz olduğundan bahsediyor. Belki de UNIQUE olarak tanımladığınız tablo alanına aynı degeri birden fazla kez girmeye çalışıyor olabilirsiniz. O alanı UNIQUE yapmadan deneyin. Ya da otomatik artacak şekilde tanımlayın.

migrateleri silip tekrar yapınca düzeldi. önceden oluşturduğum bir tablo vardı. o tabloya sonradan gerek olmadığı için modelden silip migrate etmiştim. galiba o sırada bu tabloyu veritabanından silmemiş. şimdi düzelttim

1 Beğeni