question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migration 0004_article_deleted broken: Duplicate column name 'deleted'

See original GitHub issue

Fresh project using Dj 3.1.

File "/opt/dev/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/dev/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/opt/dev/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/opt/dev/venv/lib/python3.7/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/opt/dev/venv/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1060, "Duplicate column name 'deleted'")

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
changelingcommented, Nov 22, 2021

Just to add here, there are a few migrations in the current version that are duplicated, and at least one that changes a default and should be an AlterField instead of an AddField.

1reaction
hocnxcommented, Aug 5, 2021

@Williano I face the same problem.

Try “python manage.py makemigrations” before doing “python manage.py migrate” I tried this but this cannot help. Progress stoped at blog.0004_article_deleted...

 Applying blog.0002_auto_20200618_2226... OK
  Applying blog.0003_auto_20200618_2322... OK
  Applying blog.0004_article_deleted...Traceback (most recent call last):
  File "/Users/tesuto/code/freema/myenv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

.....
    raise errorclass(errno, errval)
django.db.utils.InternalError: (1060, "Duplicate column name 'deleted'")

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate column name error when running migration
I'm a bit confused by it because it's telling me there is a duplicate column name "photo_file_name" but that I need to add...
Read more >
Migrations issue - Duplicate column name 'company_id' #1451
When I execute php artisan migrate I am given the error seen below: php ... Migrations issue - Duplicate column name 'company_id' #1451....
Read more >
Duplicate column name 'type' [#3100046] | Drupal.org
Problem/Motivation Migration source d7_field_option_translation makes error: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column ...
Read more >
migration failed m210613_145522_sortable_global_sets
Try to manually re-import your backup in an empty database (that's the important part), next, rename/remove your current config/project ...
Read more >
Refresh breaks due to COLUMN NAME CHANGES? 3 ways to ...
A simple Power BI column name change in the data source can break a power query refresh. It can be really frustrating that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found