Transition from sqlite3 to PostgreSQL