Changed upgrade script to support enum database field type. Close #981