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

VERIFIED FIXED in 6.4.4

Status

addons.mozilla.org Graveyard
Developer Pages
P2
normal
VERIFIED FIXED
7 years ago
3 years ago

People

(Reporter: krupa, Assigned: cvan)

Tracking

unspecified
6.4.4

Details

(URL)

(Reporter)

Description

7 years ago
steps to reproduce:
1. Upload a webapp and make it a premium upsell to one of your free apps.
2. Do NOT complete the Paypal settings so that app has "incomplete" status.
3. Delete the app from "My Submissions" 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`.`addon_upsell`, CONSTRAINT `premium_id_refs_id_upsell` FOREIGN KEY (`premium_id`) REFERENCES `addons` (`id`))')
Blocks: 710074
No longer blocks: 728355
Priority: -- → P2
(Assignee)

Comment 1

7 years ago
https://github.com/mozilla/zamboni/commit/f369f02
Assignee: nobody → cvan
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → 6.4.4
(Reporter)

Comment 2

7 years ago
Deleting an app with upsell settings doesn't generate a traceback-->verified.
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.