mirror of
https://github.com/flarum/core.git
synced 2025-01-17 14:18:33 +01:00
Namespace migrations to avoid potential conflicts
Core migrations are under the Flarum\Migrations\Core namespace. Extension migrations must be under the Flarum\Migrations\{ExtensionName} namespace. closes #422
This commit is contained in:
parent
633f84bbe5
commit
7fb582e8d7
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@ -9,6 +8,8 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Migrations\Core;
|
||||||
|
|
||||||
use Flarum\Migrations\Migration;
|
use Flarum\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class Migrator
|
|||||||
// First we will resolve a "real" instance of the migration class from this
|
// First we will resolve a "real" instance of the migration class from this
|
||||||
// migration file name. Once we have the instances we can run the actual
|
// migration file name. Once we have the instances we can run the actual
|
||||||
// command such as "up" or "down", or we can just simulate the action.
|
// command such as "up" or "down", or we can just simulate the action.
|
||||||
$migration = $this->resolve($file);
|
$migration = $this->resolve($file, $extension);
|
||||||
|
|
||||||
$migration->up();
|
$migration->up();
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ class Migrator
|
|||||||
// First we will get the file name of the migration so we can resolve out an
|
// First we will get the file name of the migration so we can resolve out an
|
||||||
// instance of the migration. Once we get an instance we can either run a
|
// instance of the migration. Once we get an instance we can either run a
|
||||||
// pretend execution of the migration or we can run the real migration.
|
// pretend execution of the migration or we can run the real migration.
|
||||||
$instance = $this->resolve($file);
|
$instance = $this->resolve($file, $extension);
|
||||||
|
|
||||||
$instance->down();
|
$instance->down();
|
||||||
|
|
||||||
@ -242,11 +242,13 @@ class Migrator
|
|||||||
* @param string $file
|
* @param string $file
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function resolve($file)
|
public function resolve($file, $extension = null)
|
||||||
{
|
{
|
||||||
$file = implode('_', array_slice(explode('_', $file), 4));
|
$file = implode('_', array_slice(explode('_', $file), 4));
|
||||||
|
|
||||||
$class = Str::studly($file);
|
$class = 'Flarum\\Migrations\\' . ($extension ? Str::studly($extension) : 'Core') . '\\';
|
||||||
|
|
||||||
|
$class .= Str::studly($file);
|
||||||
|
|
||||||
return app()->make($class);
|
return app()->make($class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user