framework
framework copied to clipboard
Add created_at Datetime Column To Migrations
Add executed_at date time column to the migrations table and fill it with the current time when the migration is run.
This sort of feature will be extremely helpful for larger teams to know when a particular migration ran. Having the date time will help with debugging if there is a bad migration. The time can then be used to correlate other things happening throughout the app or figure out who ran the migration.
Having access to more information without the user having to do anything seems like a win-win. Upgrading to Laravel 12 means they would have to add the column, but that is a simple migration and it's been done before when the ID column was added.
Why not stick with the created_at naming?
Why not stick with the
created_atnaming?
Sounds fine to me. My thought process was the name executed is a bit more descriptive, but people are definitely used to created_at.
Does anyone have an idea why the tests are failing?
Even if I removed my changes the tests were failing.
how is the backwards compatibility on this? will this force everyone to update their migrations table?
I think it would be good if the code could keep working even if created_at column is missing.
Could you achieve this without any code changes by using $table->timestamp('created_at')->useCurrent()?