Sha256: 34c30c750d669620e677b8dd812d470ef54944214d70ec80d41e99f690e921e1

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

= 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 (c) 2009 Justin Balthrop, Geni.com; Published under The MIT License, see License.txt

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
replicator-0.1.0 README.rdoc