README.rdoc

MyObfuscate

You want to develop against real production data, but you don't want to
violate your users' privacy. Enter MyObfuscate: standalone Ruby code
for the selective rewriting of SQL dumps in order to protect user privacy.
It supports MySQL, Postgres, and SQL Server.

Note that the -c option on mysqldump is required to use my_obfuscator.
Additionally, the default behavior of mysqldump is to output special
characters. This may cause trouble, so you can request hex-encoded blob
content with –hex-blob. If you get MySQL errors due to very long lines, try
some combination of –max_allowed_packet=128M, –single-transaction,
–skip-extended-insert, and –quick.

Database Server

By default the database type is assumed to be MySQL, but you can use the
builtin SQL Server support by specifying:

Helping with creation of the “obfuscator.rb” script

If you don't want to type all those table names and column names into
your obfuscator.rb script, you can use my_obfuscate to do some of that work
for you. It can consume your database dump file and create a “scaffold” for
the script. To run my_obfuscate in this mode, start with an “empty”
scaffolder.rb script as follows:

Scaffolding also works if you have a partial configuration. If your
configuration is missing some tables or some columns, a call to
'scaffold' will pass through the configuration that exists and
augment it with scaffolding for the missing tables or columns.

Changes

Support for Postgres. Thanks @samuelreh!

Support for SQL Server

:unless and :if now support :nil as a shorthand for a Proc that checks for
nil

:name, :lorem, and :address are all now supported types. You can pass
:number to :lorem to specify how many sentences to generate. The default
is one.

{ :type => :whatever } is now optional when no additional
options are needed. Just use :whatever.

Warnings are thrown when an unknown column type or table is encountered.
Use :keep in both cases.

{ :type => :fixed, :string => Proc { |row| ... } } is now
available.

Note on Patches/Pull Requests

Fork the project.

Make your feature addition or bug fix.

Add tests for it. This is important so I don't break it in a future
version unintentionally.

Commit, do not mess with rakefile, version, or history. (If you want to
have your own version, that is fine but bump version in a commit by itself
I can ignore when I pull)

Send me a pull request. Bonus points for topic branches.

Thanks

Thanks to Honk for the original gem, Iteration Labs for prior maintenance
work, and Pivotal Labs for patches and updates!

LICENSE

This work is provided under the MIT License. See the included LICENSE
file.