Re: Digest for south-users@googlegroups.com - 2 updates in 1 topic

4 views
Skip to first unread message

Ram Ganesh

unread,
Aug 22, 2014, 3:22:31 AM8/22/14
to south...@googlegroups.com

Thanks for your time Shai

On Fri, Aug 22, 2014 at 8:58 AM, <south...@googlegroups.com> wrote:
Ram Ganesh <ramga...@gmail.com>: Aug 21 06:56AM -0700

Hi all
 
I got this error while migrating app in django. I am using mysql
FATAL ERROR - The following SQL query failed: ALTER TABLE `my_table` ADD
CONSTRAINT `my_table_my_field_18bc0d26_uniq` UNIQUE (`my_field`)
The error was: (1062, "Duplicate entry '123' for key
'my_table_my_field_18bc0d26_uniq'")
! Error found during real run of migration! Aborting.
 
! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.
 
! You *might* be able to recover with: - no dry run output for
delete_unique_column() due to dynamic DDL, sorry
 
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS (one that supports DDL transactions)
! NOTE: The error which caused the migration to fail is further up.
 
Mysql support south or not?
 
what should i do?
 
Thanks,
 
Ram Ganesh K
Shai Berger <sh...@platonix.com>: Aug 21 11:33PM +0300

Hi,
 
On Thursday 21 August 2014 16:56:12 Ram Ganesh wrote:
> ! easier-to-deal-with DBMS (one that supports DDL transactions)
> ! NOTE: The error which caused the migration to fail is further up.
 
> Mysql support south or not?
 
South supports MySql, but MySql has limitations that South cannot fix. One of
them -- which you have run into -- is (essentially) that if a migration runs
into an error, there is no good way to cancel the whole migration
automatically.
 
If your migration had made some changes to the database before the error, you
would need to fix the database yourself, without South's help. However, it
seems like all the migration tried to do was add a unique constraint to a
single column. If that is the case, then you don't have to worry about the
scary message. The migration didn't manage to do anything anyway.
 
That said, if you have a choice about this, I recommend working with
PostgreSQL rather than MySql, exactly for the reason specified in the message;
with PostgreSQL, if an error is encountered, the whole migration can just be
rolled back. Then, you are in a much better position to fix things.
 
> what should i do?
 
First of all -- don't panic.
 
The error reported was:
> FATAL ERROR - The following SQL query failed: ALTER TABLE `my_table` ADD
> CONSTRAINT `my_table_my_field_18bc0d26_uniq` UNIQUE (`my_field`)
 
and in more detail:
 
> The error was: (1062, "Duplicate entry '123' for key
> 'my_table_my_field_18bc0d26_uniq'")
 
So, you tried to make "my_field" unique, while the database had more than one
record with my_field='123'. You need to clean up your data before you can add
the constraint.
 
HTH,
Shai.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to south-users...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages