replacing sqlite with pg