Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 315343 - eclass implementing dbdeploy strategy
Summary: eclass implementing dbdeploy strategy
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-14 21:32 UTC by Bishop Bettini
Modified: 2021-03-29 16:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The initial dbdeploy eclass. (dbdeploy.eclass,10.68 KB, text/plain)
2010-04-14 21:33 UTC, Bishop Bettini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bishop Bettini 2010-04-14 21:32:25 UTC
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?
Comment 1 Bishop Bettini 2010-04-14 21:33:43 UTC
Created attachment 227801 [details]
The initial dbdeploy eclass.
Comment 2 Panagiotis Christopoulos (RETIRED) gentoo-dev 2010-04-16 10:22:28 UTC
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
Comment 3 Bishop Bettini 2010-04-16 13:24:46 UTC
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!
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-29 16:19:41 UTC
Is this still desired..?