updating sql and model