Hi All,

I recently migrated our production database from MySQL to PostgreSQL
and found the existing scripts to be pretty inadequate (and in Perl,
blech).   Lift itself has a lot of cross database smarts built in, and
since I only access the database using models I've defined in my Lift
application, I thought, why not pipe things through mapper?  I threw
together a script which can be used as follows (it should work with
any set of DBs mapper supports):

//**make sure no one is writing to the source database
val fromDbMan = new DbMigrator.SimpleConnManager
val toDbMan = new DbMigrator.SimpleConnManager
val batchSize = 1000
DbMigrator.migrate(fromDbMan, toDbMan, batchSize, User, Dog, Employee,

println("The counts should be equal: " + User.countDb
(DbMigrator.FromConnectionIdentifier) == User.countDb

git it here: http://gist.github.com/209561

I've tested mysql->postgres and mysql->h2 and h2-> h2 though none of
my tables were bigger than thousands of rows.

- Jon
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to