geonetwork / geonetwork/core-geonetwork
Migration / Issue on 4.2.8/4.4.2 related to null settings
- Dominant language
- Java
- Stars
- 521
- Forks
- 514
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 19
Description
Similar to issue #7459
Getting the following after upgrading to 4.2.8
```
Exception in extension function
org.springframework.dao.InvalidDataAccessApiUsageException: The given id must not be
null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!
```
The migration script is buggy. The following has the wrong upgrade script.
**4.4 upgrade script**
https://github.com/geonetwork/core-geonetwork/blob/a65a9951b0eb0730a6079928db40ce6f8e540136/web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v442/migrate-default.sql#L4
**4.2 upgrade script**
https://github.com/geonetwork/core-geonetwork/blob/bc6e885987916b36d1c8dfa2d240cce44fb099cd/web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v428/migrate-default.sql#L4
It should specify the editable and encrypted value.
```SQL
INSERT INTO Settings (name, value, datatype, position, internal, editable, encrypted) VALUES ('region/getmap/useGeodesicExtents', 'false', 2, 9591, 'n', 'y', 'n');
```
To fix the issue you must manually do the following.
Also the editable and encrypted fields should be updated to be not - null to prevent this in the future.
```SQL
SELECT * FROM settings WHERE editable IS NULL;
```
Returns `region/getmap/useGeodesicExtents`
```SQL
UPDATE Settings SET editable = 'y' WHERE editable IS NULL;
```
Contributor guide
Research direction
Start with the linked web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v442/migrate-default.sql and v428/migrate-default.sql lines. Compare the Settings insert with the supplied SQL and inspect how editable and encrypted are defined or migrated; done means both upgrade scripts preserve those values and the nullable settings problem is prevented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100