Reported by Thynn Winn at https://mifosforge.jira.com/browse/MIFOSX-2812
There is a unique constraint on m_permission.code.
During our upgrade from 16.03.03 to 16.11.01, we had a code value collision and couldn't execute the permission section of upgrade script V316. We had a datatable entry with 'Address' and the code for permission was already created with grouping = datatable.
When this script V316 makes entries to m_permission with the same code values, it's erroring out.
Since users can create any values in datatable, we should either append 'datatable' in the code value as part of data table creation process or make the unique key on both columns – grouping and code (not just code alone). The former is safer for those who are using the application heavily.
This will eliminate the chance of colliding user data table values and the enhancements the community make in the upgrade scripts.