make post-import sql idempotent

Ensure that it's safe to re-run the post-import sql. This would be how
the materialized views would get refreshed without down time.