I'm trying to update a timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
field in the database to "0000-00-00 00:00:00" in certain circumstances in a Java app. Another team set up this database structure that I'm trying to work with.
I inherited an application that uses an H2 database to run tests, but Mysql database in production. I have found ways to make it work when I run it against a mysql DB, but not for the H2 DB. So all my tests keep failing.
I tried setting it to null, but that just gives an error that the field can't be null. I found that I could use ts '0000-00-00 00:00:00'
for mysql but that doesn't work in H2. Same thing with timestamp(0000-00-00 00:00:00)
.
Does anyone know if this is possible, and how I can update this field for both database systems? Or do I need to go back to the other team and ask for some sort of redesign?
EDIT I haven't found a technical solution to this. I wasn't able to convince the other team to go with NULL as suggested, but they did agree to '1970-01-01 00:00:01', which is a valid date in both H2 and MYSQL.