I have encountered a problem in improving my own database tables over the past two days!
Data storage type problem: when I first set up a data center charging system, I didn't think so much about database design, and I thought about which data is used and what type is appropriate. Now I want to normalize the data,The data design of the system is so messy that a large system will not be maintained in the future..
The first is the date type. Previously, it was stored as a string type, but there is a date type in the database. Why not use it?
I encountered some problems when using it. Sometimes I only need year, month, and day, but the datetime type is strongly added with hour, minute, and second. In this way, I have to use function filtering every time to obtain a date or a time from a duplicate.
It seems that there is no good method, otherwise it will be a string access ···
I don't know how you handle it here?
Use a string?Is maintainability low?
Or is it used?Save the entire date. Do I need to use the function to retrieve the date?In this case, it seems a little troublesome and requires conversion every time you use it.
I still prefer to use the latter. After all, such development is unified, so you don't have to worry too much about it. It will become easier even if other people will maintain it in the future.
Inspiring discussion,Let's talk about our solutions.,Learn from each other !!!