Open deshack opened 9 years ago
To allow for easier ordering, we could instead set the data type to char(8) and write the protocol in the db in the form yyyy/xxx
, e.g. 2014/001
. We should then convert it to the form xxx/yyyy
(`1/2014') when displaying it.
What do you think @nikname?
I think is a good idea, because in this way we could add a new protocol by simply increasing the previuos protocol number (do you mean this with "for easier ordering"?) (we need a stored procedure to do this). The "problem" arises with the change of the year. There are no problems with the display of the protocol number, or not?
I mean that you can use MySQL ORDER BY without any issue.
Now results are ordered like 1/2013, 1/2014, 2/2013 and so on..
Currently the data type of
protocollo
in tablepratiche
in MySQL ischar(6)
. We need to store a number in the formxx/yyyy
, where thex
represent a digit and the first one can be omitted, while theyyyy
represent the year.Therefore it may be better to change the data type to varchar(8), that way we accept protocol numbers up to 3 digits (3 digits + slash + year = 8 chars).