Project

replicator

0.0
No commit activity in last 3 years
No release in over 3 years
Easy Postgres replication for Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 2.3.9
 Project Readme

Replicator¶ ↑

Easy Postgres replication for Rails. Replicates specific columns from one table to another using auto-generated triggers. Just add simple directives in your migrations.

Usage:¶ ↑

ActiveRecord::Migration.extend(Replicator)

class AddReplication < ActiveRecord::Migration
  def self.up
    replicate :names,
      :to     => :users,
      :fields => [:first_name, :last_name]

    replicate :data,
      :to     => :users,
      :fields => [:eye_color, :height]
      :key    => 'user_id',
      :prefix => 'data'

    replicate :events,
      :to         => :users,
      :fields     => {:start_year => :year},
      :key        => 'user_id',
      :prefix     => 'type',
      :prefix_map => {'BirthEvent' => 'birth', 'GraduationEvent' => 'grad'}

    replicate :locations,
      :to         => :users,
      :fields     => [:latitude, :longitude, {[:city, :state, :country] => :location}],
      :through    => 'events.address_id',
      :key        => 'user_id',
      :prefix     => 'events.type',
      :prefix_map => {'BirthEvent' => 'birth', 'GraduationEvent' => 'grad'}
  end
end

There are a lot of options. The code is mostly self explanatory.

Install:¶ ↑

gem install replicator

License:¶ ↑

Copyright © 2009 Justin Balthrop, Geni.com; Published under The MIT License, see License.txt