updated script sql