Simple script to copy data from one database to another. This script can be used to migrate from one Database system to another one, e.q. when the SQL dumps are not compatible. Database agnosticism is achieved by using ActiveRecord.
The script just defines 2 connections, looks at the tables, creates ActiveRecord model classes on-the-fly and copies over the data.
Configure the databases using the database.yml.example as a template (the format is the same as Rails’s database.yml)
Then, run the script. The script only copies data, not structure, so make sure that you created the schema and all tables in the destination database already (use rake db:schema:load)
ARDBCopy.new("database.yml", :copy_schema => true).run!
This software was written in less than an hour. So it may contain bugs!
-
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.
Author: Copyright © 2009 Michael Siebert <siebertm85@googlemail.com>