Home > migrate_war

migrate_war

Migrate_war is a project mainly written in JAVA and RUBY, based on the MIT license.

A plugin which will create a database schema when deploying a rails app in a j2ee container (like cap deploy with migrations)

MigrateWar

Simple Rails plugin to enable migrations to be run just after the rails application loads by using the ServletContext in a JRuby/Goldspike environment. This simulates the capistrano deploy and migrate workflow.

Consists of a ServletContextListener which executes a migration when the context (i.e. the rails application) loads.

SVN repository is at http://svn.silverchairsolutions.com/migrate_war

Author: Mike Hagedorn ([email protected])

Installing the ContextListener

add the following to your web.xml. This will pull your code into the war file and make it execute on load

org.jruby.webapp.MigratorContextListener
<context-param>
    <param-name>command-file</param-name>
    <param-value>migrator.rb</param-value>
    <description>Run this file to execute an initial migration (for deployment to new platforms)</description>
</context-param>

Note that this will apply the schema to the production database, blowing away the previous contents, so back up your data before redeploying. If you what to disable the schema.rb stuff, you can either a) remove the listener definition from the web.xml or b) comment out the load comment in the migrator.rb file.

Alternatively, you could expand the migrator.rb logic and import data from fixtures or something

Copyright (c) 2008 Mike Hagedorn, http://www.silverchairsolutions.com, released under the MIT license

Previous:stickydesk