addTimestamps() has column names inverted
Hello,
I've notice that when i use addTimestamps() in my tables, it creates two columns correctly, but the functionality about update time is inverted.
Expected: created_at: get the date when row is created updated_at: get the date each time row is updated
Current: created_at: get the date each time row is updated updated_at: get the date when row is created
The only thing needed to reproduce is create a table and set addTimestamps, check the database scheme and you can see the update statement enabled in created_at column.
Cheers!
Would you be able to submit a pull request to fix this?
I think it's not inverted, look at the addTimestamp(). The issue is not setting the update option to be triggered in the column updated_at.
I don't understand, i should expect that updated_at will be the date when the row was created and created_at will change with each row update?
No. But if you look at the method, you will see that the definition of the created_at column only contains the default option, that is, only when a row is created is added the CURRENT_TIMESTAMP.
Has this been tweaked at all? I'm getting a correct column names, and created_at is working as expected, however update_at get's a null default and nothing ever changes when altering the record.
I will reiterate what @vichaunter has said. The expected behaviour is:
created_at: get the date when row is created updated_at: get the date each time row is updated
Has this been tweaked at all? I'm getting a correct column names, and created_at is working as expected, however update_at get's a null default and nothing ever changes when altering the record.
This is expected. You are responsible for updating the column yourself. I'll close this issue since the method is working as expected