Cool!  Thanks.  And good choice moving to PostgreSQL.

On Tue, Oct 13, 2009 at 2:31 PM, jon <> wrote:

> 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
> ("com.mysql.jdbc.Driver","jdbc:mysql://localhost/mydb",Full
> ("user"),Full("pass"))
> val toDbMan = new DbMigrator.SimpleConnManager
> ("org.h2.Driver","jdbc:h2:~/test;DB_CLOSE_DELAY=-1",None,None)
> val batchSize = 1000
> DbMigrator.migrate(fromDbMan, toDbMan, batchSize, User, Dog, Employee,
> Etc)
> println("The counts should be equal: " + User.countDb
> (DbMigrator.FromConnectionIdentifier) == User.countDb
> (DbMigrator.ToConnectionIdentifier))
> git it here:
> I've tested mysql->postgres and mysql->h2 and h2-> h2 though none of
> my tables were bigger than thousands of rows.
> - Jon
> >

Lift, the simply functional web framework
Beginning Scala
Follow me:
Surf the harmonics

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

Reply via email to