diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-12-13 13:01:18 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-12-13 15:18:40 +0100 |
commit | 29beda167202bebddb4f7e09e8e4e6f0a12295a3 (patch) | |
tree | c819892568f2a274b586671d3e95a0d39bfe5ece | |
parent | 0aa152d65b56a622b8fa6fcc1ee4425470ffe7d3 (diff) | |
download | sonarqube-29beda167202bebddb4f7e09e8e4e6f0a12295a3.tar.gz sonarqube-29beda167202bebddb4f7e09e8e4e6f0a12295a3.zip |
SONAR-5471 fix type of INTEGER columns on Oracle
Correct type is NUMBER(38,0) but not INTEGER
Signed-off-by: Simon Brandhof <simon.brandhof@sonarsource.com>
3 files changed, 4 insertions, 3 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/version/IntegerColumnDef.java b/sonar-db/src/main/java/org/sonar/db/version/IntegerColumnDef.java index c0420dbdf37..af26630785c 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/IntegerColumnDef.java +++ b/sonar-db/src/main/java/org/sonar/db/version/IntegerColumnDef.java @@ -46,12 +46,13 @@ public class IntegerColumnDef extends AbstractColumnDef { public String generateSqlType(Dialect dialect) { switch (dialect.getId()) { case PostgreSql.ID: - case Oracle.ID: case MySql.ID: case H2.ID: return "INTEGER"; case MsSql.ID: return "INT"; + case Oracle.ID: + return "NUMBER(38,0)"; default: throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId()); } diff --git a/sonar-db/src/test/java/org/sonar/db/version/CreateTableBuilderTest.java b/sonar-db/src/test/java/org/sonar/db/version/CreateTableBuilderTest.java index b83e2265e50..f005d1dae73 100644 --- a/sonar-db/src/test/java/org/sonar/db/version/CreateTableBuilderTest.java +++ b/sonar-db/src/test/java/org/sonar/db/version/CreateTableBuilderTest.java @@ -253,7 +253,7 @@ public class CreateTableBuilderTest { .build(); assertThat(stmts).hasSize(3); assertThat(stmts.get(0)) - .isEqualTo("CREATE TABLE table_42 (id INTEGER NOT NULL, CONSTRAINT pk_table_42 PRIMARY KEY (id))"); + .isEqualTo("CREATE TABLE table_42 (id NUMBER(38,0) NOT NULL, CONSTRAINT pk_table_42 PRIMARY KEY (id))"); assertThat(stmts.get(1)) .isEqualTo("CREATE SEQUENCE table_42_seq START WITH 1 INCREMENT BY 1"); assertThat(stmts.get(2)) diff --git a/sonar-db/src/test/java/org/sonar/db/version/IntegerColumnDefTest.java b/sonar-db/src/test/java/org/sonar/db/version/IntegerColumnDefTest.java index 8679ff24843..82888df3f33 100644 --- a/sonar-db/src/test/java/org/sonar/db/version/IntegerColumnDefTest.java +++ b/sonar-db/src/test/java/org/sonar/db/version/IntegerColumnDefTest.java @@ -97,7 +97,7 @@ public class IntegerColumnDefTest { @Test public void generateSqlType_for_Oracle() { - assertThat(underTest.generateSqlType(new Oracle())).isEqualTo("INTEGER"); + assertThat(underTest.generateSqlType(new Oracle())).isEqualTo("NUMBER(38,0)"); } @Test |