migrations-generator icon indicating copy to clipboard operation
migrations-generator copied to clipboard

created_at, updated_at - "CURRENT_TIMESTAMP" & "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"

Open niccolofavari opened this issue 6 years ago • 2 comments

Hello! I have these two columns in my tables: created_at updated_at

They're set to default "CURRENT_TIMESTAMP" and "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" respectively. These constraints are ignored by the generator. Is it somehow possible to respect those?

Thank you, Nikles

niccolofavari avatar Nov 30 '18 13:11 niccolofavari

I think laravel will print the current timestamp automatically. At least this is how it has always worked for me.

cacpmw avatar Dec 04 '18 18:12 cacpmw

I see what you mean. My point was the generated migration is losing this constraint. It works flawlessly for foreign keys but I was wondering why this one’s lost.

The resulting DB relies on the laravel app to keep those constraints working. The moment the app layer changes (or the moment someone touches a record manually or via another app) those timestamps are not updated. It’s a pity. I mean everything else works wonderfully.

Anyway as of now I’m updating the generated migrations manually to add the constraints; not a big deal for now :)

On Tue, 4 Dec 2018 at 19:39, Carlos Albuquerque Carneiro < [email protected]> wrote:

I think laravel will print the current timestamp automatically. At least this is how it has always worked for me.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Xethron/migrations-generator/issues/176#issuecomment-444209821, or mute the thread https://github.com/notifications/unsubscribe-auth/AALLjUa0i3KnOR86aVvZi4tRWjmd6JCFks5u1sF7gaJpZM4Y7uCA .

niccolofavari avatar Dec 04 '18 22:12 niccolofavari