rewrite the sql files