Schema Tool Update

I've updated my schema tool again, this time with some pretty significant changes.  Quick recap: the goal of the app is to manage your DB schema via managed code, rather than some external process, so you get transparent database upgrade to all environments as part of deploying a new version of your app.  Very handy in production, essential in development.

Here's a rundown of what's new:

  • Multiple tool types are now supported via a new 'toolfactory' CFC.  The original "database" tool has been joined by a new filesystem tool that stores it's version info in a file, rather than a database.  If you want to use the migration infrastructure for something outside a database (like your CF Admin config via the admin API) you can now do it with no database dependency using the filesystem tool.
  • The 'tool' CFC has been deprecated, in favor of 'databasetool'.  Note that with the new multi-tool arrangement, the order of init parameters has changed (since they're now passed to 'toolfactory' not the tool directly), so watch out when you're upgrading.
  • SQL-based migrations (where you use a SQL file instead of a CFC) are now a lot safer.  The original minor version computations made some assumptions about the scripts that were "mostly" safe, but not completely.  I've improved the parsing significantly (reusing some code from the Rhino project) to do string stripping/replacement, and support both — and /* */ comments.
  • This is entirely internal, but the organization of components has been much improved.  There was a lot of non-encapsulation in there originally, but I've fixed most of that, as well as done some more abstraction to get some additional logic reuse, especially across different tools.

Assuming you haven't gone hacking the core, nor subclassed 'abstractmigration' and overridden 'init', you should be able to migrate simply by replacing the line in Application.cfm that runs the tool.  Instead of creating a tool directly and invoking it, you now use the 'toolfactory' to create your tool implicitly, and then invoke it.  best online slots canada The demo app has an example.  It also has an example of a filesystem tool, with separate migration script directories for each tool to manage.

A ZIP is available here, or you can browse the Subversion repository directly.  As always, comments/questions/bugs are welcome and appreciated.

Comments are closed.