Skip to content

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

License

Notifications You must be signed in to change notification settings

mwhagedorn/migrate_war

Repository files navigation

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
  


  <listener>
    <listener-class>org.jruby.webapp.MigratorContextListener</listener-class>
  </listener>


	<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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published