anlek/mongify — pull request #35 by hammady (2014-03-06 11:12:50+00:00)
Title: Adding sync functionality to copy only new/updated records

With the new 'sync' command, mongify can be ran repeatedly as it only copies new records or updates the updated ones. The only prerequisite is to have an 'updated_at' column that should be updated each time a record is updated. For Ruby ActiveRecord, this is the default behaviour and no extra coding is required.
For non ActiveRecord database manipulation, such field should be created in the schema and updated on each update with the current system time.
Sync works by creating a special table in the Sql database to store the last updated_at timestamp for each synced table. Each time it is invoked, it only selects rows having a bigger updated_at. It keeps the pre_mongified_id in the mongoDB because it is always needed for consecutive sync runs.