dbdeploy is a strategy for migrating a database from earlier to later versions through the use of delta SQL files. Originally implemented for Java, with a later evolution in Phing, PEAR, and .NET, the strategy is documented at: http://dbdeploy.com/documentation/ Each delta has a change number, and when that numbered changed is applied to a given DB, the number is remembered in a changelog table. Thus, a change will be applied only once, to a given database, and the history of applied changes can be easily queried within the database itself. Many applications have SQL that should be applied to the database, but do not rely upon Java or PHP, so the existing dbdeploy implementations are not convenient for these applications. We have developed a dbdeploy eclass to allow ebuilds to apply database changes from within the ebuild. Our prototype implementation has concrete support for MySQL, but this can be easily extended to PostgreSQL and other DBMS. A sample usage in an ebuild is: ebegin "Applying changes to database" dbdeploy --list | # get the list of already applied deltas mysql -u "me" --password="my password" -D "myDB" -NB | dbdeploy --apply "mysql5" "/path/to/the/deltas/" | # get the SQL for the unapplied changes mysql -u "me" --password="my password" -D "myDB" -NB eend $? || die "Error migrating database." As you can see, the eclass is not concerned with the mechanics of reading from or writing to the database. That is package-dependent and is left to the package to implement. The eclass provides only the SQL, for a given DBMS, necessary to list the changes applied so far and the SQL to apply changes from a given directory. Is this something the Gentoo community would be interested in having available?
Created attachment 227801 [details] The initial dbdeploy eclass.
Thanks for your report and the attachment. Our current policy regarding eclasses (http://devmanual.gentoo.org/eclass-writing/index.html) is to discuss about them in our mailing lists, until they are ready to reach the main tree, so we finally mail them to gentoo-dev@lists.gentoo.org for a last discussion/approval. I would recommend to start a thread in our gentoo-server or gentoo-admin mailing lists, and see if anyone is interested in your eclass, and in what it does. For more information about our mailing lists, please see: http://www.gentoo.org/main/en/lists.xml
Whoops -- RTM! We're tweaking the initial implementation today, and I'll follow up with the procedure you outlined. Leave this bug open, or mark as LATER? Thanks!
Is this still desired..?