plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: Creating migration when generating Model via plugin uses local datetime in filename and not UTC

Open Jelmerkeij opened this issue 11 months ago • 1 comments

Bug description

For this example my local time is now 22nd of March 2024, 11:38. And UTC is 22nd of March 2024, 10:38 (so 1 hour earlier).

When creating a Migration via: Action menu > New Eloquent Model > (checkbox) Create Migration a new migration file is indeed created, but the local time is used in the filename: 2024_03_22_113800_create_my_table.php .

When I create a migration via the artisan command, the UTC time is used: php artisan make:migration create_my_table gives 2024_03_22_103800_create_my_table.php.

This makes the migration created via the artisan command appear and execute "before" the other one which can cause issues when using foreign keys on tables that are not yet created by a now later executed migration.

Should the plugin use UTC time in migration filename as well?

Plugin version

8.1.3.233

Operating system

MacOS

Steps to reproduce

  1. Create a Migration via the plugin: Action menu > New Eloquent Model > (checkbox) Create Migration
  2. See the migration filename use local time (which is not always UTC)
  3. Create a migration via Artisan command: php artisan make:migration create_my_table
  4. See the migration filename use UTC time

Relevant log output

No response

Jelmerkeij avatar Mar 22 '24 10:03 Jelmerkeij

That's a very good point. I'll try to fix it. Thank you.

adelf avatar Mar 22 '24 10:03 adelf

Fixed in 8.1.4

adelf avatar May 01 '24 15:05 adelf