mirror of
https://github.com/flarum/core.git
synced 2025-08-12 19:34:18 +02:00
feat(em): port extension manager from 1.0 (#3959)
* feat(em): port extension manager from 1.0 * Apply fixes from StyleCI * chore: phpstan --------- Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
return Migration::createTable(
|
||||
return Migration::createTableIfNotExists(
|
||||
'package_manager_tasks',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->table('package_manager_tasks', function (Blueprint $table) use ($schema) {
|
||||
if (! $schema->hasColumn('package_manager_tasks', 'guessed_cause')) {
|
||||
$table->string('guessed_cause', 255)->nullable()->after('output');
|
||||
}
|
||||
});
|
||||
},
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->table('package_manager_tasks', function (Blueprint $table) use ($schema) {
|
||||
if ($schema->hasColumn('package_manager_tasks', 'guessed_cause')) {
|
||||
$table->dropColumn('guessed_cause');
|
||||
}
|
||||
});
|
||||
}
|
||||
];
|
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$schema->rename('package_manager_tasks', 'extension_manager_tasks');
|
||||
$schema->getConnection()->table('migrations')->where('extension', 'flarum-package-manager')->delete();
|
||||
},
|
||||
'down' => function (Builder $schema) {
|
||||
$schema->rename('extension_manager_tasks', 'package_manager_tasks');
|
||||
$schema->getConnection()->table('migrations')->where('extension', 'flarum-extension-manager')->update([
|
||||
'extension' => 'flarum-package-manager',
|
||||
]);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user