R6 – A table being referenced has not been found in the DB schema (WMB)

A table being referenced has not been found in the DB schema (WMB)

The idea around these database related rules is that they can give early feed back as to any configuration differences between the database and the IIB/WMB code.
Is this case the code analysis is looking to validate that all the tables references in the code exist in the database.
This will prevent runtime issues in the future when the code is executed.
It worked by connecting to the database, building a model of the tables, columns and indexes and then matches those against the code. Ideally it would run against a “production” like database.

The differences could be attributed to

  • Spelling mistakes in the code
  • Updates to the database that have been applied that have not been reflected in the code
  • New features in the code where the appropriate database change has not been applied

The rule uses the following settings in the sonar.properties file to allow it to connect to a database.

sonar.mb.jdbc.driver org.postgresql.Driver
sonar.mb.jdbc.url jdbc:postgresql://localhost/DemoDB
sonar.mb.jdbc.user test-user-name
sonar.mb.jdbc.password test-password