MR: Revision 2745 and up -- Syncdb breakage, and why

13 views
Skip to first unread message

Clint Ecker

unread,
Apr 25, 2006, 12:00:01 PM4/25/06
to django...@googlegroups.com
After updating to revision 2747 this morning I tried installing a new app in my project and found Django trying to reinstall permissions.  After a bit of digging I found out that my "names" in auth_permissions had uppercase chars in them instead of lowercase (ie. 'Can add Group' instead of 'Can add group').  This caused syncdb to try and re-add the permissions and die because a restraint placed on this table stops it from duplicating that information.

Anyway, I found out that the cause of this was a slight change made in revision 2745 ( http://code.djangoproject.com/changeset/2745 ), where the verbose names of the Users and Groups were lowercased. 

Purpose of this email: if you're running into syncdb breakage after updating to a 2745+ revision of MR, just go into auth_permission table and change the 'Can * Group' and 'Can * User' stuff to 'Can * group' and 'Can * user' respectively.
 
Hope this helps out anyone who runs into this!

---
Clint Ecker
clint...@gmail.com
http://phaedo.cx

Rudolph

unread,
Apr 25, 2006, 2:58:40 PM4/25/06
to Django users
This should be on the Magic Removal wiki page, including SQL commands
to update the records. I'll create the PostgreSQL commands within a few
hours and post them here.

Rudolph

unread,
Apr 25, 2006, 6:06:54 PM4/25/06
to Django users
Fix this in PostgreSQL like this:

BEGIN;
UPDATE auth_permission set name='Can add group' where
codename='add_group';
UPDATE auth_permission set name='Can change group' where
codename='change_group';
UPDATE auth_permission set name='Can delete group' where
codename='delete_group';
UPDATE auth_permission set name='Can add user' where
codename='add_user';
UPDATE auth_permission set name='Can change user' where
codename='change_user';
UPDATE auth_permission set name='Can delete user' where
codename='delete_user';
COMMIT;

Rudolph

unread,
Apr 25, 2006, 6:38:11 PM4/25/06
to Django users
The above fixes the issue, but to completely remove all uppercased
names also do:

BEGIN;
UPDATE django_content_type set name='group' where model='group';
UPDATE django_content_type set name='user' where model='user';
COMMIT;

Clint Ecker

unread,
Apr 25, 2006, 7:55:48 PM4/25/06
to django...@googlegroups.com

Thanks for putting those together, now I'm trying to figured out where the best place to put this information is?

Is this a good place? http://code.djangoproject.com/wiki/RemovingTheMagic#Databasechangesyoullneedtomake

Or does that only deal with changes from 0.9.1 to 0.91MR? 

Ken Kennedy

unread,
Apr 25, 2006, 10:55:55 PM4/25/06
to Django users
I'd say put 'em there!

Rudolph

unread,
Apr 26, 2006, 8:36:22 AM4/26/06
to Django users
This revision also causes another minor bug. When running syncdb it
tells you
Adding permission '<Permission object>'
for every permission. This is caused by the __repr__ and __str__
changes. Shall I file a bug report?

Clint Ecker

unread,
Apr 26, 2006, 8:48:03 AM4/26/06
to django...@googlegroups.com
There was already a bug report on this, and a simple patch:

http://code.djangoproject.com/ticket/1677


Clint Ecker

unread,
Apr 26, 2006, 9:15:39 AM4/26/06
to django...@googlegroups.com
On 4/25/06, Ken Kennedy <ken...@gmail.com> wrote:

I'd say put 'em there!

Done
Reply all
Reply to author
Forward
0 new messages