Unique Id issue

11 views
Skip to first unread message

ephan

unread,
Dec 12, 2012, 1:55:34 AM12/12/12
to django...@googlegroups.com
Hi all,

Am in a bit of a fix which I put myself in,I have the following models:

class  Town(...):
    name = models.CharField(unique=true)
    province = models.foreignKey(Province)


class Area(....):
    name = models.CharField(unique=true,max_length=120)
    town = models.CharField(Town)


The problem here is I made the assumption that an area name is unique,unfortunatly after deploying ,I have just realized that some towns have the same area names so I can't have example area x in town A as  well as area x in town B.

We have already deployed and have 575 users so far,is there any safe way of removing the unique key constraint on Area model without damaging the records which are already there?
   


Jani Tiainen

unread,
Dec 12, 2012, 2:30:44 AM12/12/12
to django...@googlegroups.com
You can remove it safely. Though you have to run some SQL script
manually (or to use some migration tool like South) to remove it from
the database(s).

--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...
Reply all
Reply to author
Forward
0 new messages