Skip to content

Upgrade an existing installation

When upgrading Timesketch you might need to migrate the database to use the latest database schema. This is how you do that.

Backup you database (!)

First you should backup your current database in case something goes wrong in the upgrade process. For PostgreSQL you do the following (Ref:

$ sudo -u postgres pg_dump timesketch > ~/timesketch-db.sql
$ sudo -u postgres pg_dumpall > ~/timesketch-db-all.sql

Change to your Timesketch installation directory

(e.g. /opt/timesketch)


Upgrade the database schema

Have you backed up your database..? good. Let's upgrade the schema. First connect to the timesketch-web container:

$ docker-compose exec timesketch-web /bin/bash

While connected to the container:

root@<CONTAINER_ID>$ git clone
root@<CONTAINER_ID>$ cd timesketch/timesketch
root@<CONTAINER_ID>$ tsctl db current

If this command returns a value, then you can go ahead and upgrade the database.

In case you don't get any response back from the db current command you'll need to first find out revisions and fix a spot to upgrade from.

root@<CONTAINER_ID>$ tsctl db history

Find the lasat revision number you have upgraded the database too, and then issue

root@<CONTAINER_ID>$ tsctl db stamp <REVISION_ID>

And now you are ready to upgrade.

root@<CONTAINER_ID>$ tsctl db upgrade 

Upgrade timesketch

Exit from the container (CTRL-D), then pull new versions of the docker images and upgrade Timesketch:

$ docker-compose pull
$ docker-compose down
$ docker-compose up -d