Re: Changing a constraint with live data

2011-01-07 Thread Sithembewena Lloyd Dube
Thanks Shawn. Great to note that someone has thought of this before.

On Wed, Jan 5, 2011 at 5:24 PM, Shawn Milochik  wrote:

>
> On Jan 5, 2011, at 4:44 AM, Sithembewena Lloyd Dube wrote:
>
> Thomas and Shawn, thanks for responding.
>
> South looks pretty useful - I hope that it could be included in the
> standard Django distribution.
>
>
> This has been discussed quite a bit, and a plan has been made to do this --
> in a way. South itself won't be integrated into Django, but the South
> project will be divided into two separate pieces. One will be built into
> Django, and will allow users to make their own migration front-end. The
> other will be the third-party South app which you can use to take advantage
> of the built-in backend.
>
> http://www.aeracode.org/2010/6/2/django-and-migrations/
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing a constraint with live data

2011-01-05 Thread Shawn Milochik

On Jan 5, 2011, at 4:44 AM, Sithembewena Lloyd Dube wrote:

> Thomas and Shawn, thanks for responding.
> 
> South looks pretty useful - I hope that it could be included in the standard 
> Django distribution.
> 

This has been discussed quite a bit, and a plan has been made to do this -- in 
a way. South itself won't be integrated into Django, but the South project will 
be divided into two separate pieces. One will be built into Django, and will 
allow users to make their own migration front-end. The other will be the 
third-party South app which you can use to take advantage of the built-in 
backend.

http://www.aeracode.org/2010/6/2/django-and-migrations/

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing a constraint with live data

2011-01-05 Thread Sithembewena Lloyd Dube
Thomas and Shawn, thanks for responding.

South looks pretty useful - I hope that it could be included in the standard
Django distribution.

On Tue, Jan 4, 2011 at 6:20 PM, Shawn Milochik  wrote:

> You could do this with South in multiple steps.
>
> 1. South schema migration:
>Add the new field for the proper foreign key, but don't make the field
> required.
>
> 2. South data migration:
>Create a migration that appropriately populates the new field based on
> whatever rules you have.
>
> 3. South schema migration:
>Make the new field required, and optionally delete the old field.
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing a constraint with live data

2011-01-04 Thread Shawn Milochik
You could do this with South in multiple steps. 

1. South schema migration:
Add the new field for the proper foreign key, but don't make the field 
required.

2. South data migration:
Create a migration that appropriately populates the new field based on 
whatever rules you have.

3. South schema migration:
Make the new field required, and optionally delete the old field.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing a constraint with live data

2011-01-04 Thread Thomas Guettler
I use south for migrations. I have done something like this
with south, but with postgres not mysql.

I don't know if mysql supports deferrable foreign key constraints.

  Thomas

Sithembewena Lloyd Dube wrote:
> Hi everyone,
> 
> Happy 2011.
> 
> I am having an interesting problem where I need to change the foreign
> key on a model (A) to reference a different model. problem is, the table
> for A
> is populated with records and MySQL does not seem able to drop it. I ran
> manage.py sql and would like to drop the existing constraint and add the
> new one.
> Is there a straightforward way to do this?

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.