[Nix-dev] What cuold be the nix way updating database versions?

Eelco Dolstra e.dolstra at tudelft.nl
Tue Jan 6 13:50:46 CET 2009


Hi,

Marc Weber wrote:

> Problem: Sometimes you have to upgrade databases..
> 
> Examples
>   Mysql 4 -> Mysql 5
> only minor version update:
>   Mysql 5.0 -> Mysql 5.1
> 
> AFAIK MySQL can handle updates gracefully and using postgresql it's
> recommended to export and reimport all data? At least I've read once
> that this has been an argument pro MySQL.
> 
> nix is very cool because you could ask nix to dump and reimport tables
> automatically whenever either the database vesrion changes or the
> database store path.

Actually we don't have a good handle on mutable state in Nix yet.  It doesn't
know anything about the format of any file whatsoever, and format conversions
cannot be done generically - they require application-specific support.  Also,
if you do a roll-back to the older version, should you just restore a backup of
the data, or try to convert the data back to the old version (which might be lossy)?

In NixOS, the cleanest way to handle format changes would be in the start/stop
scripts of the Upstart job in question.  E.g. the mysql job should convert to
the new format when it encouters an old database.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list