]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6840 Number are accepted in table name
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 17 Sep 2015 15:41:13 +0000 (17:41 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 18 Sep 2015 13:32:56 +0000 (15:32 +0200)
sonar-db/src/main/java/org/sonar/db/version/ColumnDefValidation.java
sonar-db/src/test/java/org/sonar/db/version/ColumnDefValidationTest.java

index ed017bcb70520be79d647b4e640e9ff5c4f3e4ce..786388fef963485d96a980b009e18af2ac562791 100644 (file)
@@ -35,7 +35,8 @@ public class ColumnDefValidation {
 
   public static String validateColumnName(@Nullable String columnName) {
     String name = requireNonNull(columnName, "Column name cannot be null");
-    checkArgument(JAVA_LOWER_CASE.or(CharMatcher.anyOf("_")).matchesAllOf(name), String.format("Column name should only contains lowercase and _ characters, got '%s'", columnName));
+    checkArgument(JAVA_LOWER_CASE.or(CharMatcher.anyOf("_")).or(CharMatcher.DIGIT).matchesAllOf(name),
+      String.format("Column name should only contains lowercase and _ characters, got '%s'", columnName));
     return name;
   }
 }
index 6cbdb35d58e3b93ec489d26a0b1fc9b44b85cc2f..423a49356bf87b8135b0659a12fc202594ae63bf 100644 (file)
@@ -34,6 +34,7 @@ public class ColumnDefValidationTest {
   @Test
   public void accept_valid_table_name() throws Exception {
     validateColumnName("date_in_ms");
+    validateColumnName("date_in_ms_1");
   }
 
   @Test