Properly translate fold/quality into quality factor

Also add db migration file