write DB migration tool from old built-in server package
warner opened this issue · 1 comments
When the Mailbox Server lived inside the magic-wormhole
repo (executed with the wormhole-server start
command), it recorded both mailbox state and usage data inside a single SQLite database named relay.sqlite
.
Now that this server has its own repository, it's time to write some migration tools. These tools will live in misc/migrate_relay_db.py
and misc/migrate_usage_db.py
. They should look like https://github.com/warner/magic-wormhole-transit-relay/blob/0.1.2/misc/migrate_usage_db.py , taking the original relay.sqlite
as an argument, and creating either relay.sqlite
or usage.sqlite
in the current directory (checking that it doesn't already exist first, an important safety check given that the old DB and new DB have the same filename). It should copy all rows from the old DB into the new one, synthesizing fields as necessary.
This should probably wait until we finish #3, but I suppose it doesn't strictly need to (the migration tool could produce a not-current version of the target schema, and then you'd need to upgrade it before use).