diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/database')
-rw-r--r-- | juick-server/src/main/java/com/juick/database/MySqlUpdater.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/database/MySqlUpdater.java b/juick-server/src/main/java/com/juick/database/MySqlUpdater.java index 469dad10..c087ee29 100644 --- a/juick-server/src/main/java/com/juick/database/MySqlUpdater.java +++ b/juick-server/src/main/java/com/juick/database/MySqlUpdater.java @@ -10,7 +10,6 @@ import org.springframework.transaction.support.TransactionTemplate; import org.springframework.util.Assert; import javax.annotation.PostConstruct; -import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -26,7 +25,7 @@ import static org.springframework.transaction.TransactionDefinition.PROPAGATION_ */ public class MySqlUpdater { private static final Pattern UPDATE_PATTERN = Pattern.compile( - "update\\s+(version|`version`)\\s+set\\s+(version|`version`)\\s+=\\s+(\\d+)", + "update\\s+(version|`version`)\\s+set\\s+(version|`version`)\\s+=\\s*(\\d+)", Pattern.CASE_INSENSITIVE); private final Logger logger = LoggerFactory.getLogger(getClass()); @@ -84,8 +83,7 @@ public class MySqlUpdater { Matcher m = UPDATE_PATTERN.matcher(sql); if (m.matches()) { - String actual = m.group(3); - actualVersion = Long.valueOf(actual); + actualVersion = Long.valueOf(m.group(3)); if (actualVersion > currentDbVersion) { updateInTransaction(changesSql); |