Fix adding new objects

This required a step for creating the storage folders as well as making sure the
database config can be fetched even when run from a bin script.
Fix an incorrect table schema

Also remove the "drop table" commands.
Throw an error when a database query fails

Easier to debug things when it doesn't fail silently.