timestamp_on_create type not working for built in MySQL DB

Hello, I’ve noticed that even though I have a column in some of my tables set to the “timestamp_on_create” dreamfactory type, as of 1.7.1, the timestamp is getting set to this zero string: “0000-00-00 00:00:00” in the database, even though it was working correctly in 1.6.10 and setting the correct timestamps when data was posted. (This is for the internal MySQL database by the way.)
(I realize that in the default field in the schema editor, that zero string is what it is set to for the timestamp_on_create type. Again, this was fine in 1.6.10, it still put in the actual timestamp when I posted data, but in 1.7.1, it actually does fill the column in with that default zero string, which is obviously a problem.)

I’ve created a workaround by manually going into the database with phpmyadmin and setting that column’s default value to be CURRENT_TIMESTAMP, which makes it work as expected. However, if I make any changes and save them with dreamfactory’s schema editor, it switches it back to the default being “0000-00-00 00:00:00”, which makes any data being posted have have that column filled in with that zero string.

I’ve made sure that the dreamfactory type is “timestamp_on_create”, the database type is “timestamp”, and that the validation field is filled in as “api_read_only”, but it still won’t correctly fill in the timestamp when data is posted like it would on 1.6.10. I can keep doing the workaround every time I edit the schema using dreamfactory’s schema editor, but I assume we would also like to fix the bug here, so any help you could give me would be great.


Hey - we appreciate the heads up on this issue. Our engineers are looking into this, and we’ll have an update for you soon.

Thanks again,

  • Mark

Thanks Mark, you’ve been awesome with the help today!


No worries man! Try setting that service_id column to your actual service_id (from df_sys_service table in phpmyadmin) of the db service… then you should be in business.

Let me know how this works.


  • Mark

Hey Mark, maybe I’m getting a bit turned around, but I’m not sure what you mean by a service_id column for my table schema. I was having a problem with a column that I created that I have set as dreamfactory type of “timestamp_on_create” with DB type “timestamp”. I’m using the built in MySQL database for these tables, so I’m not sure if maybe the service_id you’re talking about still applies, I’m not seeing anything like that.

There is another table called df_sys_schema_extras where the xxx_on_create and xxx_on_update schema settings are kept. Previous releases failed to set the mapped service_id field (you will see a null value there). There is a row for each table-field combo. Set this to the id of your service (from the df_sys_service table, probably 1 since that has typically been the first service created).

I have a new version with this and another fix coming up shortly.

Sounds good, I’ll watch out for it.