Integrity Field Guide
Common Causes Of Database Errors
Incorrect Permissions For the Database User
Integrity uses the metadata from a database to give it hints. This is particularly important for record ids generated from sequences and default values. The problem is often evidenced by Integrity inserting a NULL into a table, which generates an exception that looks like the exception below:
(ActiveRecord::StatementInvalid) "ODBC::Error: 23000 (515) [unixODBC][FreeTDS][SQL Server]Cannot insert the value NULL into column 'rows_uploaded', table 'Integrity.dbo.upload_attempts'; column does not allow nulls.
Here we are using SQL Server to store our metadata. upload_attempts is a metadata table generated when Integrity is installed. The default for rows_uploaded should be zero however Integrity can't read the metadata for the schema and so attempts to insert a NULL. In order to fix this a DBA needs to run the following:
GRANT VIEW DEFINITION ON SCHEMA::dbo TO <integrity database user>
And then restart the application as it caches the details of the metadata to improve performance.