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
end
Foo.connection.execute( "insert into #{Foo.working_table_name} values ('foofoo')" )
Foo.advance_version
Foo.first
( MySQL support only for now )
Advertisement