sql changes for mirrored entities