WIP: raw file migration from database to file system

See specific comments below for review.