Currently I have a table in mysql with 3 columns. added_date(datetime), completion_date(date) and expired(date). completion_date and expired columns have their default value set to 0000-00-00. Now I'm trying to create an index for the table by the added_date column for which I'm using this statement:
ALTER TABLE listings ADD INDEX added_date (added_date)
This gives me an error saying Invalid default value for 'completion_date'
So now to change the default value to null in my table I'm using the following command:
ALTER TABLE `listings` CHANGE `completion_date` `completion_date` DATE NULL DEFAULT NULL;
Which gives an error saying Invalid default value for 'expired'
and the same vice versa. Now I've also tried creating 2 alter table statements like so:
ALTER TABLE `listings` CHANGE `completion_date` `completion_date` DATE NULL DEFAULT NULL;
ALTER TABLE `listings` CHANGE `expired` `expired` DATE NULL DEFAULT NULL;
But this again gave me the same error saying Invalid default value for 'expired'