CFWheels DBMigrate plugin
Started with http://code.google.com/p/cfwheels-dbmigrate/ which last released 0.6 in October 2010.
Now trying the 0.8.2 release of its fork on Github, https://github.com/charliecochran/cfwheels-dbmigrate-plugin
We use the plugin CF DB Migrate for all updates we need to make to our application's database. (The Ruby on Rails and CF on Wheels crowd calls updating schema and data in your application migrating data.) DB Migrate takes care of keeping track of what was the last update to run (in a 'schemainfo' table it creates in your application database), and provides for rollback capability when it is possible for us to write 'down' statements to accompany the 'up' statements for updates.
- Do one thing in each migration (what would be one SQL statement). DBMigrate has no internal rollback capability. It can only run your 'down' statements (if the 'up' was successful. If the there are several statements in one file, and the first one works but the second fails, DBMigrate has run part of, say, 002 but will list 002 as un-run and try to run it from the beginning on another try. Related:
- Always back up your database before running a migration.
- Go to rewrite.cfm?controller=wheels&action=wheels&view=plugins&name=dbmigrate to run the migration (index.cfm at the start may not work)
See http://code.google.com/p/cfwheels-dbmigrate/w/list (especially as easiest way to look up different column types)
Creating a new table
A primary key named id will automatically be added by default when you create a table.
http://code.google.com/p/cfwheels-dbmigrate/wiki/TutorialCreate
Updating data (not schema)
http://code.google.com/p/cfwheels-dbmigrate/wiki/APIMigrationUpdateRecord
Varchar is String
For changeColumn columnType definitions or addColumn, varchar is string:
http://code.google.com/p/cfwheels-dbmigrate/wiki/APITableDefinitionString
More
http://code.google.com/p/cfwheels-dbmigrate/wiki/APITableDefinitionInteger
http://code.google.com/p/cfwheels-dbmigrate/wiki/APITableDefinitionDate
http://code.google.com/p/cfwheels-dbmigrate/wiki/APIMigrationAddColumn
http://code.google.com/p/cfwheels-dbmigrate/wiki/TutorialModify
Comments
Post new comment