1
0
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:
Sami Mazouz
2024-01-22 18:58:08 +01:00
committed by GitHub
parent 8f29b7af82
commit 3fbe05fd18
114 changed files with 2003 additions and 636 deletions

View File

@@ -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');

View File

@@ -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');
}
});
}
];

View File

@@ -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',
]);
}
];