[traceback] IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`addons_dev2`.`previews`, CONSTRAINT `previews_ibfk_1` FOREIGN KEY (`addon_id`) REFERENCES `addons` (`id`))')

VERIFIED FIXED in 6.4.3

Status

VERIFIED FIXED
7 years ago
3 years ago

People

(Reporter: krupa.mozbugs, Assigned: cvan)

Tracking

unspecified
6.4.3

Details

(Reporter)

Description

7 years ago
steps to reproduce:
1. Delete an app from the My submission page

traceback details:
Traceback (most recent call last):

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/data/www/addons-dev.allizom.org/zamboni/apps/amo/decorators.py", line 112, in wrapper
    return f(*args, **kw)

  File "/data/www/addons-dev.allizom.org/zamboni/apps/amo/decorators.py", line 104, in wrapper
    return f(*args, **kw)

  File "/data/www/addons-dev.allizom.org/zamboni/apps/addons/decorators.py", line 29, in wrapper
    return f(request, addon, *args, **kw)

  File "/data/www/addons-dev.allizom.org/zamboni/apps/amo/decorators.py", line 29, in wrapper
    return func(request, *args, **kw)

  File "/data/www/addons-dev.allizom.org/zamboni/mkt/developers/decorators.py", line 35, in wrapper
    return fun()

  File "/data/www/addons-dev.allizom.org/zamboni/mkt/developers/decorators.py", line 27, in <lambda>
    *args, **kw)

  File "/data/www/addons-dev.allizom.org/zamboni/mkt/developers/views.py", line 161, in delete
    addon.delete('Removed via devhub')

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/transaction.py", line 211, in inner
    return func(*args, **kwargs)

  File "/data/www/addons-dev.allizom.org/zamboni/apps/addons/models.py", line 397, in delete
    super(Addon, self).delete()

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/base.py", line 584, in delete
    collector.delete()

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/deletion.py", line 62, in decorated
    func(self, *args, **kwargs)

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/deletion.py", line 253, in delete
    query.delete_batch(pk_list, self.using)

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/sql/subqueries.py", line 44, in delete_batch
    self.do_query(self.model._meta.db_table, where, using=using)

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/sql/subqueries.py", line 29, in do_query
    self.get_compiler(using).execute_sql(None)

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/models/sql/compiler.py", line 750, in execute_sql
    cursor.execute(sql, params)

  File "/data/www/addons-dev.allizom.org/zamboni/vendor/src/django/django/db/backends/mysql/base.py", line 86, in execute
    return self.cursor.execute(query, args)

  File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
    self.errorhandler(self, exc, value)

  File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue

IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`addons_dev2`.`previews`, CONSTRAINT `previews_ibfk_1` FOREIGN KEY (`addon_id`) REFERENCES `addons` (`id`))')
Assignee: nobody → kumar.mcmillan
(Assignee)

Comment 1

7 years ago
https://github.com/mozilla/zamboni/commit/6bc1650
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Thanks cvan
Assignee: kumar.mcmillan → cvan
Target Milestone: --- → 6.4.3
(Reporter)

Comment 3

7 years ago
verified at https://marketplace-dev.allizom.org/en-US/developers/submissions
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.