Skip to content

Commit

Permalink
prevent migration from being published multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jun 28, 2015
1 parent 916e000 commit b91a156
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`

Expand Down
12 changes: 7 additions & 5 deletions src/MediaLibraryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

/**
Expand Down

0 comments on commit b91a156

Please sign in to comment.