Migrate from 0.8 to 1.0 with sqlite

We are trying to migrate from Drone 0.8.9 to 1.0 using the migration utility.
We use the default database configuration, i.e. a SQLite database.

We cannot get past the first step.
We created a backup of the original DB and a new empty database, but the “setup-database” step always fails with the error “unable to open database file”

Is it required to create the target database before the first step?
If so, can you give me a command line to create a new database? (I am not familiar with SQLite, so I googled and found sqlite3 drone10.sqlite "")

More details on what we tried:

$ ls -l
total 21G
drwxr-xr-x  2 root root 4.0K Jun 12 17:36 .
drwxr-xr-x 41 root root 4.0K Mar 11 15:01 ..
-rw-r--r--  1 root root 8.3G Jun 12 16:49 drone.sqlite
-rw-r--r--  1 root root 4.3G Aug  7  2018 drone.sqlite-backup
-rw-r--r--  1 root root 8.3G Jun 12 16:53 drone.sqlite.20190612
-rw-r--r--  1 root root    0 Jun 12 17:36 drone10.sqlite

$ docker run \
    -e SOURCE_DATABASE_DATASOURCE=/[...]/drone.sqlite \
    -e TARGET_DATABASE_DATASOURCE=/[...]/drone10.sqlite \
    drone/migrate setup-database
time="2019-06-12T15:42:06Z" level=debug msg="target database driver: sqlite3"
time="2019-06-12T15:42:06Z" level=debug msg="target database datasource: /[...]/drone10.sqlite"
time="2019-06-12T15:42:06Z" level=fatal msg="unable to open database file"

Any help would be appreciated.

Are you mounting the files into the docker image?

You could try to use the binary directly. I was able to migrate a sqlite DB that was ~6GB (maybe 7GB), and had several thousand builds using the binary directly.

Good ideas. Indeed, I did not mount the DB files into the Docker image.
Using the binary is also a good alternative, I did not think about it.

In the end, I decided to skip data migration and start with an empty DB. We did not really need to keep the history of the builds and our configuration was pretty standard.

Thanks for your help.

1 Like