Replace sqlite with pg