I am doing a contracting system and the contracts can be extended up to one (1) year, so the user will only insert the day of creation of the contract and the months of the contract.
As you can see in the image, create an enum type column for a range of values from 1 to 12 to later calculate the contract expiration dates through PHP.
I did it this way since the data type INT(2)
or VARCHAR(2)
could insert values outside the range [1-12]. I could also declare the data type DATE
inserting under the following format 0000-03-00
(which would be "March") but as I think the database should not perform these calculations I decided for the ENUM
.
Is that an adequate way to do it? How could it be done better?