#9253: auto-generated db identifiers (eg. constraint names) should be of
consistent length
------------------------------------------+---------------------------------
Reporter: crucialfelix | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.0
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
where hashes are used to create auto-generated db identifier names, the
hash should produce a string of consistent length regardless of the
environment or OS.
otherwise SQL generated on one system may work, while generating it on
another system won't (mysql does not allow identifiers longer than 64
chars).
eg.
in django.db.creation.backends.py line 127
{{{
r_name = '%s_refs_%s_%x' % (r_col, col, abs(hash((r_table, table))))
}}}
and all other places like that
{{{
# mac
ALTER TABLE `website_artistmailout_lists` ADD CONSTRAINT
artistmailout_id_refs_absmail_ptr_id_1347fdf FOREIGN KEY
(`artistmailout_id`) REFERENCES `website_artistmailout`
(`absmail_ptr_id`);
ALTER TABLE `website_artistmailout_lists` ADD CONSTRAINT
accountlist_id_refs_id_7f9cd4c6 FOREIGN KEY (`accountlist_id`) REFERENCES
`mailings_accountlist` (`id`);
CREATE TABLE `website_artistmailout_users` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`artistmailout_id` integer NOT NULL,
`user_id` integer NOT NULL,
UNIQUE (`artistmailout_id`, `user_id`)
)
#ubuntu
ALTER TABLE `website_artistmailout_lists` ADD CONSTRAINT
artistmailout_id_refs_absmail_ptr_id_607b768a01347fdf FOREIGN KEY
(`artistmailout_id`) REFERENCES `website_artistmailout`
(`absmail_ptr_id`);
ALTER TABLE `website_artistmailout_lists` ADD CONSTRAINT
accountlist_id_refs_id_695205280632b3a FOREIGN KEY (`accountlist_id`)
REFERENCES `mailings_accountlist` (`id`);
CREATE TABLE `website_artistmailout_users` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`artistmailout_id` integer NOT NULL,
`user_id` integer NOT NULL,
UNIQUE (`artistmailout_id`, `user_id`)
)
}}}
note: in this particular case the contraint name is below 64 chars, but
only because I changed the names of the models to avoid the problem.
the ouch was that it previously worked on the dev server but not the
deployment.
--
Ticket URL: <http://code.djangoproject.com/ticket/9253>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---