Fixed database migrations

The previous migrations only worked when the database was already created.
The new migrations do work with new databases. People do have to recreate their database, though, so it's not perfect.