2017-04-17 21:31:45 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use App\Album;
|
|
|
|
use App\DataMigration;
|
|
|
|
|
|
|
|
class DataMigrationV2_0_0_alpha_1 extends DataMigration
|
|
|
|
{
|
2017-04-19 09:12:36 +01:00
|
|
|
public function getVersion()
|
|
|
|
{
|
|
|
|
return '2.0.0-alpha.1';
|
|
|
|
}
|
|
|
|
|
2017-04-17 21:31:45 +01:00
|
|
|
public function run($currentVersion)
|
|
|
|
{
|
|
|
|
$this->storeAlbumUrlPaths();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensures all albums have a full URL path stored.
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
private function storeAlbumUrlPaths()
|
|
|
|
{
|
|
|
|
$albumsWithNoPath = Album::where('url_path', null)->get();
|
|
|
|
|
|
|
|
/** @var Album $album */
|
|
|
|
foreach ($albumsWithNoPath as $album)
|
|
|
|
{
|
|
|
|
$album->touch();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|