deshack / kyss

Keep Your Stuff Simple is a Linux User Group management system written in PHP.
2 stars 0 forks source link

Change protocollo type in pratiche #57

Open deshack opened 9 years ago

deshack commented 9 years ago

Currently the data type of protocollo in table pratiche in MySQL is char(6). We need to store a number in the form xx/yyyy, where the x represent a digit and the first one can be omitted, while the yyyy 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).

deshack commented 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?

nikname commented 9 years ago

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?

deshack commented 9 years ago

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..