Skip to content

Migrating the database from DIBS version 0.4 to 0.5

Mike Hucka edited this page Oct 9, 2021 · 17 revisions

DIBS version 0.5 brings significant changes and new features, but it is also not fully backward compatible with version 0.4. Apart from updating the settings.ini file (which has some format changes) and examining differences in the HTML page templates (if you made any changes in your local installation of DIBS), the most serious change is in the database object models used in the DIBS database.

We provide two scripts in 0.5 that we hope will help with migration. They are located in the admin subdirectory of the DIBS source tree.

  • export-data can be used to produce CSV or JSON files out of the separate database tables in DIBS. It is particularly useful for migration: run export-data with its default settings and then use that in combination with import-data.
  • import-data can be used to import an archive produced by export-data, to (re)load a DIBS database.

Here is a rough sequence of actions that should help reload a database from version 0.4 into a version 0.5 installation of DIBS. This assumes you have already downloaded the version 0.5 distribution of DIBS somewhere on the same computer where you have installed version 0.4.

  1. If you already have data in your new version 0.5 DIBS database, make a backup copy of that database file (the one named dibs.db, or whatever you configured it to be in your existing settings.ini file). This is only a precaution if you have real data in your database; you can skip this if you are starting with a fresh installation of DIBS 0.5.
  2. Find export-data from the 0.5 distribution of DIBS (it's in the admin subdirectory) and run
    export-data --base-name saved  --database PATH-TO-YOUR-EXISTING-DIBS.DB
    
    to produce a file named saved.zip in the current directory. Replace PATH-TO-YOUR-EXISTING-DIBS.DB with the path to your existing 0.4 DIBS database file, wherever it may be on the computer. (Note: you can use the new export-data program even with the 0.4 version of the DIBS database.)
  3. Go to your DIBS 0.5 installation, and assuming the path to your 0.5 database is PATH-TO-NEW-DIBS.DB, now run
    import-data --database PATH-TO-NEW-DIBS.DB  PATH-TO-saved.zip
    
    where PATH-TO-saved.zip is the path to the saved.zip file created in step #2.

This should add to the DIBS 0.5 database file all the item, person and history saved from the previous installation of DIBS. It will skip duplicate entries (i.e., items with duplicate barcodes, people with duplicate uname values).

Clone this wiki locally