Fix a bug in the db patching (JOINDIN-305)

https://joindin.jira.com/browse/JOINDIN-305