Added database management support

Now it's possible to handle migrations and have easy access to
the underlying database.