DumpTruck
A simple DSL to specify how to dump data from a production environment for use in a developer environment. Provides tools to limit what data is pulled and obfuscate data that is pulled.
Installation
Add this line to your application's Gemfile:
gem 'dump_truck'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dump_truck
Usage
Create a ruby file that looks like this:
require 'logger'
DumpTruck.configure do
logger Logger.new('dump.log')
database(:mysql) do
hostname ENV['hostname']
user ENV['user']
password ENV['password']
schema 'app_production' do
target_path ENV['target_path']
target_file{|schema| schema + Time.now.strftime("_%Y%m%d%H%M%S")}
table_default do
keep "created_at > now() - interval 6 month"
obfuscate(:email){|email, n| "my.email+#{n}@gmail.com"}
end
table(:users) do
keep
obfuscate(:email){|email, n| "my.email+#{n}@gmail.com"}
obfuscate(:password){'password'}
obfuscate(:name){|name| name.split('').shuffle.join}
end
table(:delayed_jobs){keep "deleted_at is null"}
table(:roles){keep}
table(:emails){truncate}
table(:credit_cards){ignore}
end
end
end
Contributing
- Fork it ( http://github.com/secondrotation/dump_truck/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request