-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL: Ticket state: Use native sort of enumerations instead of separate sort column #173
Comments
Note: This can AFAIK not replace the sort column completely, because there is no native support for (ordered) enums in PHP. To have the states ordered there, the sort is still needed. |
Where would we need this? I can't finde any reference to https://github.com/crs-tools/tracker/blob/master/src/Application/Model/Project.php#L78-L79 but this is only a query. As we only use strings in PHP, we don't do additional sorting there. |
There is an order in every dropdown where a state can be selected (Ticket edit / mass edit). Additionally, in the "States" view of project settings the states are in the correct order as well as in the dropdown for the dependee ticket trigger state. So e.g. it is used additionally here: The other mentioned functionalities seem to derive correct order from the $States property of a project model instance. |
We need ordering, sure, but ordering in PostgreSQL would still work, doesn't it? What I was trying to say: We don't need support for ordered enums in PHP, as we don't use enums anyway. Arrays in PHP are ordered maps, so when we get ordered results from PostgreSQL this would be enough. |
Correct, my concern was just to get the order from the database into PHP. Since most code seems to rely on a central logic for this, it might be a lot easier than I initially thought. |
tbl_ticket_state
has a column sort to store the order of the ticket states.PostgreSQL supports native ordering of enumeration types and relies on the order of the values when the type was created. So this could replace the sort column for ordering ticket states.
Note: To replace a enum type which is in use, the following migration is proposed:
The text was updated successfully, but these errors were encountered: