Re: Django Schema Migration

2007-04-29 Thread daev
Here is Schema Evolution Project home site: http://code.google.com/p/django-schemaevolution/ Any feedbacks are welcome daev wrote: > It's very funny but couple of dayes ago I start to write some schema > wvolution framework for django. I've read articles in django-code wiki > about schema evolu

Re: Django Schema Migration

2007-04-23 Thread daev
It's very funny but couple of dayes ago I start to write some schema wvolution framework for django. I've read articles in django-code wiki about schema evolution and make some major decisions. I realized that the better way(for me) not to analize application model definition but to analize django

Re: Django Schema Migration

2007-04-23 Thread lcaamano
FYI, this is very similar to the approach we've used since 2001 when doing schema updates of our product, DynaCenter (http:// www.racemi.com). It has nothing to do with Django but the problem domain is the same. Our scripts are called "alter scripts" instead of migrators. We also added version

Re: Django Schema Migration

2007-04-22 Thread Jeremy Dunck
On 4/20/07, Mike H <[EMAIL PROTECTED]> wrote: > It seems to be working well for the developers here, so here's hoping > it's useful for some other people too :) This is interesting-- migrating django apps using django. Are there cases where Django or the DB could become so broken that the migrato

Re: Django Schema Migration

2007-04-22 Thread Mike H
Hi Jeremy, I see your point, and yes, migrations can be run out of sequence - although in practice I've found that it is rarely an issue and if it is, it can be resolved fairly simply. Let's take a couple of examples. I'm not trying to be condescending, just thinking it through outloud ;) 1)

Re: Django Schema Migration

2007-04-20 Thread David Marko
GREAT WORK! Migrations are being discussed for years and now we have some real-life solution. And I must say - it works and helps. Now we should get rid of SQL, we need some nice DSL syntax. David --~--~-~--~~~---~--~~ You received this message because you are s

Re: Django Schema Migration

2007-04-20 Thread Mike H
Hi again, The docs have been updated with the points you raised. Cheers! Mike On 4/20/2007, "Mike H" <[EMAIL PROTECTED]> wrote: > > >Ah, yes, the docs aren't clear on this at the moment, but the automatic >schema creation does not run if you use migrations for an application. >You will have

Re: Django Schema Migration

2007-04-20 Thread Mike H
Ah, yes, the docs aren't clear on this at the moment, but the automatic schema creation does not run if you use migrations for an application. You will have to create a migration that creates the tables. (Just use 'python manage.py sqlall' to get the sql for the migration) The reason for this is

Re: Django Schema Migration

2007-04-20 Thread David Marko
Thanks for an advice. I found problem with migrations when running tests - python manage.py test . It seems that migration is run before django creates table based on model. Tests should probably not run migratons at all. --~--~-~--~~~---~--~~ You received this me

Re: Django Schema Migration

2007-04-20 Thread Mike H
Ah, thanks for the heads up! Unfortunately, syncdb will install the latest SQL for all installed applications (as far as I am aware). Is there a way just to install the schema for a specific application? I guess I could call sqlall and run each supplied statement, but that's pretty much just rei

Re: Django Schema Migration

2007-04-20 Thread Mike H
Hi David, The python functionality is there so that you can manipulate the models directly or run more complex dynamic sql if you need to. Let's say that your app is called "myapp" and you want to do something special to all User records with an aol email address, but that something special is

Re: Django Schema Migration

2007-04-20 Thread David Marko
How can 'Python migrations' be used? Can someone explain or place some example? Where should I put the function? --- excerpt from docs --- Using Python migrations Sometimes it might be easier to do your migration using Python and the Django models. To define a python migration, simply define a fu

Re: Django Schema Migration

2007-04-20 Thread Mike H
Actually, those ramblings might not be relevant just yet... I made a simple patch to syncdb to see if an application has a migrations module or not. If it does, it will run it. If not, it will do its automated thing. Seems to work quite well at the moment and let me get rid of about a third of t

Re: Django Schema Migration

2007-04-20 Thread Mike H
Yeah, eventually I'd like to have the migrations define column additions, deletions and renames using the models from Django. However this is my first foray into the internals of Django so I would have a lot of reading to do! I'm wondering if the schema-evolution branches would have code I can re

Re: Django Schema Migration

2007-04-20 Thread Oliver Charles
Hey, this is neat! It's just a shame that it doesn't use Python models or some type of database agnostic representation - any plans there? Great work non the less though! -- Ollie > Hi all, > > Release 0.01 of the migration module can be downloaded from > http://www.aswmc.com/dbmigration/ > a

Re: Django Schema Migration

2007-04-20 Thread Mike H
Hi all, Release 0.01 of the migration module can be downloaded from http://www.aswmc.com/dbmigration/ as well as a patch to integrate it into the syncdb command. It seems to be working well for the developers here, so here's hoping it's useful for some other people too :) MikeH --~--~

Re: Django Schema Migration

2007-04-20 Thread Russell Keith-Magee
On 4/20/07, Mike H <[EMAIL PROTECTED]> wrote: > > Before I release the code, I want to make the migrator call 'install' > from django.core.management if it doesn't find a migration module for > an app. Also, as this is being done as part of a work project, I have to > get permission to release the

Re: Django Schema Migration

2007-04-20 Thread Mike H
Thanks Ned, that's certainly something I want to bear in mind. At the moment the dbmigration code only uses sql migrations, but the way the migrator is put together will allow me to build support for migrations written in python quite easily. Before I release the code, I want to make the migrato

Re: Django Schema Migration

2007-04-19 Thread Ned Batchelder
Just one comment on this: At Tabblo, we've found it very useful to have not only SQL migrations, but Python migrations as well, because database migrations involve not just schema changes, but also data changes. While SQL can be used to update the data, it can be much easier to do it with Pyt

Re: Django Schema Migration

2007-04-19 Thread Russell Keith-Magee
On 4/19/07, Mike H <[EMAIL PROTECTED]> wrote: > > I've been working on a tool to give me an automated way of altering the > schemas on servers I deploy my django applications to. I know about the > schema-evolution branch, but the current approach of that isn't > completely automated and the work

Re: Django Schema Migration

2007-04-19 Thread David Marko
Hello, Can you share the initial code with us? This approach seems to be good. Do you have experience on some project? David Mike H napsal: > Hi all, > > I've been working on a tool to give me an automated way of altering the > schemas on servers I deploy my django applications to. I know about

Django Schema Migration

2007-04-19 Thread Mike H
Hi all, I've been working on a tool to give me an automated way of altering the schemas on servers I deploy my django applications to. I know about the schema-evolution branch, but the current approach of that isn't completely automated and the work seems to have stopped on it. The approach I h