Updated upgrade script