On Wed, 2007-05-23 at 17:52 +0200, Atilla wrote: > On 23/05/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Tue, 2007-05-22 at 06:43 -0700, Fay wrote: > > > I'm using MySQL. The primary key field generated by django uses > > > integer, not unsigned. I'd like to us unsigned integer instead. I can > > > explicitly specify PositiveIntegerField with primary_key option, but > > > that doesn't seem to give me auto increment. Any ideas? Thanks. > > > > Write the necessary SQL to alter the table after it's created and put it > > in the "initial SQL" file for that model. See the model-api docs for > > more information on initial SQL. > > > > Regards, > > Malcolm > > > > However, it doesn't make much sense to have signed auto-incremental > keys, does it? > > I'd say that unsigned should be the default result, instead of having > to define this yourself. What are the reasons for having them signed > by default ? Database engines with no support for signed/unsigned > columns ?
No bigs reason, but it doesn't hurt and it isn't worth changing now. If the difference between unsigned and signed is a showstopper for a particular project, then the extra factor of two doesn't really buy you much safety anyway. You might as well switch to some kind of really huge field. One advantage of this setup is that you could manually set the primary key values yourself and providing you stuck to negative values, there would be no chance of a clash. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---