Jump to content

Database Schema Issue: Date And Datetime Default Values


SAUDIS

Recommended Posts

Hi all,

 

Whilst building a new development environment I believe I've found a bug in the .sql structure code. The issue is that for a number of fields which have a date or datetime type the default values are set to values which actually are invalid or the equivalent of NULL.

 

At present the default values are as follows for the following types:

  • date: 00-00-00
  • datetime: 00-00-00 00:00:00

Having read the MySQL reference guide this would expose them as NULLS:

 

Data Type Zero Value DATE '0000-00-00' TIME '00:00:00' DATETIME '0000-00-00 00:00:00' TIMESTAMP '0000-00-00 00:00:00' YEAR 0000

 

In a number of cases the fields are also set to not allow null values which the .sql code would try and insert. Could the developers look at setting the default values as below?

  • date: 1000-01-01
  • datetime: 1000-01-01 00:00:00

reference documentation:

date & datetimehttp://dev.mysql.com/doc/refman/5.7/en/datetime.html

 

Regards,

 

 

Steven.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...