WORM tables for ActiveRecord

November 4, 2009

do you do large offline batch jobs and load the results into a database table ?

do you want there to be a smooth changeover from the previous version of the results to a new version, with no rollbacks or lock timeouts ?

activerecord_worm_table allows an ActiveRecord model to be backed by several database tables, an active table, a working table and one or more historical tables. data is loaded into the working table, and when finished the working table becomes the active table. the old active table becomes a historical table, and any active queries continue using that table

it’s available from gemcutter :

gem install activerecord_worm_table

and it’s easy to use :

class Foo < ActiveRecord::Base
  include ActiveRecord::WormTable
Foo.connection.execute( "insert into #{Foo.working_table_name} values ('foofoo')" )

( MySQL support only for now )

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: