diff --git a/CHANGELOG.md b/CHANGELOG.md index 61c886786..1ee097b62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All Notable changes to `laravel-medialibrary` will be documented in this file +#1.6.1 +- Bugfix: prevent migration from being published multiple times + #1.6.0 - Added: `Spatie\MediaLibrary\Models\Media::getHumanReadableFileSize()` diff --git a/src/MediaLibraryServiceProvider.php b/src/MediaLibraryServiceProvider.php index fedbc01b1..c3bbbda31 100644 --- a/src/MediaLibraryServiceProvider.php +++ b/src/MediaLibraryServiceProvider.php @@ -25,12 +25,14 @@ public function boot() __DIR__.'/ToPublish/config/laravel-medialibrary.php' => config_path('laravel-medialibrary.php'), ], 'config'); - // Publish the migration - $timestamp = date('Y_m_d_His', time()); + if (! class_exists('CreateMediaTable')) { + // Publish the migration + $timestamp = date('Y_m_d_His', time()); - $this->publishes([ - __DIR__.'/ToPublish/migrations/create_media_table.php' => base_path('database/migrations/'.$timestamp.'_create_media_table.php'), - ], 'migrations'); + $this->publishes([ + __DIR__ . '/ToPublish/migrations/create_media_table.php' => base_path('database/migrations/' . $timestamp . '_create_media_table.php'), + ], 'migrations'); + } } /**