Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migrationFileExists function #7

Merged
merged 1 commit into from
Feb 2, 2021
Merged

Fix migrationFileExists function #7

merged 1 commit into from
Feb 2, 2021

Conversation

hamrak
Copy link
Contributor

@hamrak hamrak commented Feb 2, 2021

Because you have on line 59 variable $migrationFileName without .php and you set it:

$this->package->basePath("/../database/migrations/{$migrationFileName}.php.stub") => database_path('migrations/' . now()->format('Y_m_d_His') . '_' . Str::finish($migrationFileName, '.php')),

so you must check existing migrations (function migrationFileExists) with .php extension too.
If you don't do that, condition can not work properly, e.g. current functionality return false te_users_table.php === create_users_table.
This pull request fix this condition and it will return true _create_users_table.php === create_users_table.php.

Because you have on line 59 variable $migrationFileName without .php and you set it:                       
```
$this->package->basePath("/../database/migrations/{$migrationFileName}.php.stub") => database_path('migrations/' . now()->format('Y_m_d_His') . '_' . Str::finish($migrationFileName, '.php')),
```
so you must check existing migrations (function migrationFileExists) with .php extension too. 
If you don't do that, condition can not work properly, e.g. current functionality return false _te_users_table.php === create_users_table_.
This pull request fix this condition and it will return true __create_users_table.php === create_users_table.php_.
@freekmurze freekmurze merged commit d9dc79d into spatie:master Feb 2, 2021
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants