[WIP] Multi database

Introduces SQLite and PostgreSQL support as database backends.