Thanks James and Russel for your replies.

Am 04.10.2008 um 07:22 schrieb Russell Keith-Magee:
>
> On Sat, Oct 4, 2008 at 12:36 PM, Benjamin Buch <[EMAIL PROTECTED]>  
> wrote:
>>
>> Is there somewhere a place in the documentation where SQL migration
>> strategies are explained a little?
>> I think I remember a paragraph in the pre-1.0-documentation that
>> described what you have to do with your database when you'd like to
>> add a column to your model, but I can't find it anymore.
>
> This isn't the sort of thing that Django can document easily (and I
> certainly can't recall it ever being mentioned in the Django docs).
> The problem is that is isn't as simple as 'the SQL statement you need
> to run' - every database does it quite differently.

Yes, documenting the whole thing would not be easy, you're absolutely  
right.

But some hints on strategy would be very helpful I guess.
Not in the sense of written SQL statements for every database, and not  
for every problem which could propably emerge when the models evolve.
But I think there are some common patterns - like adding a field to a  
model - that could be described in a way that would be sufficient as  
an entry point to learning SQL.
When I remember it right, then the paragraph I mentioned (I think it  
was in the tutorial...) was something like
- alter your model
- use manage.py sql altered_app to output the SQL statements you would  
use to create the table
- alter the table along the lines of those statements

At least this was a hint what to do...

Or possibly another hint could be something like
- dump the database tables you want to alter
- put in the changes manually
- delete the (now old) tables in your db
- import the altered dump

(I don't know if this works, but I will try...)

So I'm not looking for a full-feldged documentation, just for some  
hints on strategy or some examples as a starting point to dive in  
deeper.

>> Working with django for some weeks now, I find it quite common to  
>> want
>> to add or modify a column after the db is synced and some (valuable)
>> data is put in.
>> Since it will propably take some time that the three great migration
>> apps will merge(?) somehow and find their way into trunk (at least
>> that's the way I understood it when watching the video from django
>> con...),
>> I dicided to do migration by hand.
>
> Merging Django Evolution, South and dmigrations is certainly something
> that the three of us have discussed. We hope to be able to make some
> public announcements about this in the near future.

I'm looking forward to this! I liked the talk on django con...

> In the meantime, any of the three migration projects are usable as-is.
>
>> I don't know SQL, and I find it quite hard to search for  
>> documentation
>> (although there is good documentation about SQL out there...), think
>> about migration strategies and tinker with differences between  
>> sqlite3
>> and mysql.
>> So is there anywhere a short explanation of SQL from a django point  
>> of
>> view out there?
>
> Your best source of documentation will be the SQL manual for your
> database of choice, and/or the tutorials around the web for the same.
> There's almost nothing Django specific about migrations at the SQL
> level, other than knowing what you need your database to look like at
> the end of the process (which you can find out using ./manage sqlall).

As James said, I should stop and learn some SQL.
Thanks for the tip on manage.py, it is quite useful.
At least it shows how SQL statements should look...

-benjamin

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to