Fix SQL script