Revert "remove raw SQL update hack"

This reverts commit 7c2a71475bc772a80477111475b099902d499fa0.