Enhancement
Changing the datatype of an old occurrence type
Issue description
Usually the datatype of an occurrence type does not change. Somtimes it is required which makes it necessary to update existing occurrences. In the case at hand the vat rate of country was nonNegativeInteger, but Finland has 25.5 now. It is no problem to change the respective occurrence datatype constraint and a trigger should, after a check, update the rows in the occurrences table accordingly to use the new datatype.
Developer comments
It was considered to use a service instead of a simple trigger since there is a small danger that the administrator does not edit the existing occurrences datatype constraint, but deletes it and creates a new one. But fixing this wrong doing is acutally quite easy: you just need to set it to string and then the correct datatype. This will have the same effect. The actual values of the occurrences are never touched during the whole process. Some services of the store might run into problems, but generally this can easily be reverted by switching back.
It works now for simple cases, given that the value space of the existing occurrences is sub space of the new datatype, e.g. if it is currently %decimal%, but all values are either %0% or %1% you can change it to %boolean%.
More complicated changes might need to switch it to %string%, transform the values with a script and only then change the datatype to the acutal one.
|
Work sessions2
Start |
2025-08-01T10:50:46
|
End |
2025-08-01T11:24:33
|
Participant |
Robert Cerny
|
Start |
2025-08-01T12:59:31
|
End |
2025-08-01T14:42:41
|
Participant |
Robert Cerny
|
|
We are sorry
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.