Refactor: Database: Move views into own file

The view definitions wanted to be in their
own file.
Refactor: Database: Make 'ensureExists' function

Clean up a few log commands and make the database
creation code slightly cleaner.