attachments & database migrations fixes