Changed database

Changed database code to use Postgresql instead of sqlite.