Create the database prior to adding an edition

Previously, it was trying to create a new edition before creating the
database tables, which failed if the database tables didn't yet exist.
Misc. code formatting changes