Skip to content

Commit

Permalink
Fix install and reinstall proccess
Browse files Browse the repository at this point in the history
  • Loading branch information
reziamini committed May 5, 2022
1 parent 12f9615 commit 39875b2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCrudsTable extends Migration
class CreateCrudsTableEasypanel extends Migration
{
/**
* Run the migrations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserAdminsTable extends Migration
class CreatePanelAdminsTableEasypanel extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,6 +30,6 @@ public function up()
*/
public function down()
{
Schema::dropIfExists('cruds');
Schema::dropIfExists('panel_admins');
}
}
15 changes: 7 additions & 8 deletions src/Commands/Actions/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ private function dropTables()
{
Schema::dropIfExists('cruds');
Schema::dropIfExists('panel_admins');
Schema::dropIfExists('role_user');
Schema::dropIfExists('roles');
}

private function deleteFiles()
Expand All @@ -55,15 +57,12 @@ private function deleteFiles()

private function deleteMigrations()
{
$migrationFiles = File::allFiles(__DIR__."/../../../database/migrations");
$migrationFiles = File::glob(database_path('migrations/*easypanel.php'));

$migrationsTable = DB::table('migrations');
foreach ($migrationFiles as $migration) {
$migrationName = \Illuminate\Support\Str::between($migration->getFileName(), "999999", ".php");
File::delete($migrationFiles);

$migrationsTable->orWhere('migration', 'like', "%$migrationName");
}

$migrationsTable->delete();
DB::table('migrations')
->where('migration', 'like', '%easypanel')
->delete();
}
}
5 changes: 2 additions & 3 deletions src/EasyPanelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ private function mergePublishes()
$this->publishes([__DIR__ . '/../resources/assets' => public_path('/assets/admin')], 'easy-panel-styles');

$this->publishes([
__DIR__ . '/../database/migrations/2021_07_17_999999_create_cruds_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_cruds_table.php'),
__DIR__ . '/../database/migrations/2021_12_17_999999_create_user_admins_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_user_admins_table.php'),
__DIR__ . '/../database/migrations/2022_04_19_999999_add_acl_fields_to_cruds_table.php' => base_path('/database/migrations/' . now()->tomorrow()->format('Y_m_d') . '_999999_add_acl_fields_to_cruds_table.php')
__DIR__ . '/../database/migrations/cruds_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_cruds_table_easypanel.php'),
__DIR__ . '/../database/migrations/panel_admins_table.php' => base_path('/database/migrations/' . date('Y_m_d') . '_999999_create_panel_admins_table_easypanel.php'),
], 'easy-panel-migration');

$this->publishes([__DIR__.'/../resources/lang' => app()->langPath()], 'easy-panel-lang');
Expand Down

0 comments on commit 39875b2

Please sign in to comment.