Assignee
Type
bug
Priority
major
Status
resolved
Watchers
1

IntegrityError at /accounts/invite/

Nara Narasimhan avatarNara Narasimhan created an issue

Hi,

I just installed the invitation app (latest from bitbucket). I did a python manage.py syncdb to add the two invitation tables to my MySQL db. I also followed instructions on updates to settings.py and url.py.

Not sure if I need other preliminary steps, but I don't think so. I can provide the entire stack trace if that is useful, please email me directly at nara19 (yahoo or gmail).

I'd appreciate a fast response, since I am blocked on this. See rest of report for details.

Thanks Nara

When I go to accounts/invite, or try to run a script that initially provides a few invites to each user, I get this error:

IntegrityError at /accounts/invite/

(1452, 'Cannot add or update a child row: a foreign key constraint fails (`juglr`.`invitation_invitationuser`, CONSTRAINT `inviter_id_refs_id_3bdeeb07` FOREIGN KEY (`inviter_id`) REFERENCES `auth_user` (`id`))')

Request Method: GET Request URL: http://nara:8000/accounts/invite/ Django Version: 1.4c2 Exception Type: IntegrityError Exception Value:

(1452, 'Cannot add or update a child row: a foreign key constraint fails (`juglr`.`invitation_invitationuser`, CONSTRAINT `inviter_id_refs_id_3bdeeb07` FOREIGN KEY (`inviter_id`) REFERENCES `auth_user` (`id`))')

Exception Location: /home/nara/virtualenvs/d3/local/lib/python2.7/site-packages/MySQLdb/connections.py in defaulterrorhandler, line 36 Python Executable: /home/nara/virtualenvs/d3/bin/python Python Version: 2.7.3

Comments (2)

  1. Nara Narasimhan

    Hi,

    the problem was that just the invitation tables were being created as INNODB, whereas the rest of my entire database was in MYISAM. (By the way, I use south, but south is used only for my own apps)

    I had to delete the tables (I use PHPMyAdmin for MySQL), add this line to settings:

    DATABASES = { 'default': { ... 'OPTIONS' : { 'init_command' : 'SET storage_engine=MYISAM', }, } } and run syncdb again. This resolved the issue.

    I got a clue about this from here: http://stackoverflow.com/questions/5269810/explicitly-set-mysql-table-storage-engine-using-south-and-django

    Thanks Nara

  2. Log in to comment »
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.