Wednesday, August 28, 2013

Re: help required on how to modify constraints/indexes of unique_together after data is loaded


Hi

Found the solution
 ran the following sql directly and it worked fine

ALTER TABLE  `table_name`
DROP INDEX `field1`
, ADD UNIQUE INDEX `field1` (`
field1` ASC, `field2` ASC, `field3` ASC) ;



Also checked a distinct on the three fields to ensure data integrity


Thanks
Subramanyam


On Tuesday, August 27, 2013 5:52:05 PM UTC+5:30, Subramanyam wrote:

Hi
 
Initially when we created the table we had two fields as unique_together = ( 'field1',field2') and quite some data has been added with the same

Later we added one more field to unique_together = ( 'field1',field2','field3')

how can I flush the old constraints/indexes created and add the new ones


Thanks
-Subramanyam

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment