Keeping python code and database in sync
Frank Millman
frank at chagford.com
Fri Aug 29 08:42:06 EDT 2014
Hi all
Now that I have bitten the bullet and published my repository, I am forced
to change my working practices (which is a good thing!).
The project is inherently database-driven. The python code expects to find
certain tables and columns in the database. As I develop new features, I
sometimes need to modify the database structure. In the bad old days (like
yesterday) I would just make the modifications and carry on. Now I have to
be aware that others may have downloaded the project, so I have to consider
how to ensure that their database is kept up to date.
It is a simple matter to write a program that updates the database
automatically. The question is, what should trigger such an update? My first
thought is to use a version number - store a version number in the working
directory, and have a matching number in the code. If someone downloads the
latest version, the numbers will no longer match, and I can run the upgrade
program.
The problem with that is that version numbers are usually reserved for
tagged releases, but this could happen as the result of any commit in the
current development cycle.
Any suggestions?
Frank Millman
More information about the Python-list
mailing list