Installation | Maintenance | Beyond Lino

Database Migration

A Python dump of a database is a snapshot that can be used for data migration à la Lino.

When you upgrade to a newer version of the application you are running, or when you change certain parameters in your, then this might require changes in the database structure. This is called database migration.

  • Before upgrading or applying configuration changes, create a Backup.

  • After upgrading or applying configuration changes, restore your database from that backup. The script will automatically detect version changes and apply any necessary changes to your data.

For example, here is a upgrade with data migration:

$ go prod
$ a
$ python dump2py 20130827
$ python run 20130827/

It is of course recommended to stop any other processes which might access your database during the whole procedure.

Double Dump Test (DDT)

A Double Dump Test is a method to test for possible problems e.g. after a Database Migration: we make a first dump of the database to a Python fixture, then we load that picture to the database, then we make a second dump to a fixture And finally we launch diff to verify that both pictures are identical.


When successfully terminated without any warnings and error messages, then there are good chances that your database has been successfully migrated.

But here is one more automated test that you may run when everything seems okay: a Double Dump Test (DDT).

This consists of the following steps:

  • make another dump of the freshly migrated database to a directory a.

  • restore this dump to the database

  • make a third dump b

  • Compare the files a and b: if there’s no difference, then the double dump test succeeded!

In other words:

$ python dump2py a
$ python run a/
$ python dump2py a
$ diff a b

If there’s no difference between the two dumps, then the test succeeded!