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 have taken is very simple. Inside each application
installed in your project, you create a migrations module. Inside there
is a list of migrations that need to be applied and an sql directory
that contains the actual migrations themselves.

For example :

cms/
    migrations/
        migrator.py -- holds the list of migrations to run, in the order
to run them
        sql/
            InstallInitialStructure.sql
            AddNewAttributeColumn.sql
            ... etc. ...

So with this approach you would create the initial structure sql file
using the django sql generation, then you would have to produce sql
files for each addition / deletion / merge you need to make.

The sql directory can have subdirectories named the same as your database
engine if you need an engine specific sql file.

All that is needed is to copy a migrate.py script into the root of your
project and run 'python migrate.py' - any migrations on any of the
installed applications that have not been run would automatically get
run and a log kept so that migrations do not run twice.

Does this sound useful to anyone who is doing automated deployments?

Mike

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