Skip to content

Commit

Permalink
fix(install): Enabled option for removing previous migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
anibalealvarezs committed Feb 11, 2022
1 parent 6b05f71 commit dd21137
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 133 deletions.
1 change: 1 addition & 0 deletions src/Commands/PbAltInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PbAltInstallCommand extends Command
{--update : pachage will be updated before installation}
{--publish : Resources will be published to the application}
{--migrate : Migrations will be run}
{--reset : Migrations will be removed from migrations directory}
{--seed : Tables will be seeded}
{--config : Application wil be configured}
{--link : Links will be created}
Expand Down
6 changes: 1 addition & 5 deletions src/Commands/PbInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PbInstallCommand extends Command
{--update : pachage will be updated before installation}
{--publish : Resources will be published to the application}
{--migrate : Migrations will be run}
{--reset : Migrations will be removed from migrations directory}
{--seed : Tables will be seeded}
{--config : Application wil be configured}
{--link : Links will be created}
Expand Down Expand Up @@ -59,11 +60,6 @@ public function installInertia(): bool
echo "------ [[ ERROR: Jetstream installation failed failed ]]\n";
return false;
}
echo "---- Installing providers...\n";
if (!$this->installProviders()) {
echo "------ [[ ERROR: proviers couldn't be installed ]]\n";
return false;
}
} catch (Exception $e) {
echo "------ [[ ERROR: ".$e->getMessage()." ]]\n";
return false;
Expand Down
33 changes: 0 additions & 33 deletions src/Database/Migrations/make_configkey_column_unique.php.stub

This file was deleted.

33 changes: 0 additions & 33 deletions src/Database/Migrations/make_modulekey_column_unique.php.stub

This file was deleted.

33 changes: 0 additions & 33 deletions src/Database/Migrations/make_name_column_unique.php.stub

This file was deleted.

29 changes: 0 additions & 29 deletions src/Database/Migrations/rename_logger_and_config_tables.php.stub

This file was deleted.

20 changes: 20 additions & 0 deletions src/Traits/PbInstallTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ public function installProjectBuilder(): bool
}
}
if ($this->option('migrate') || $this->option('seed') || $this->option('all') || (str_starts_with($this->signature, 'pbuilder:update')) || (str_starts_with($this->signature, 'pbuilder:altupdate'))) {
if ($this->confirm("'Do you want to remove previous migration files?")) {
echo "------ Removing previous migration files\n";
if (!$this->removePreviousMigrations()) {
echo "-------- [[ ERROR: Error removing migrations files ]]\n";
return false;
}
}
echo "---- Configurating database...\n";
if (!$this->migrateAndSeed()) {
return false;
Expand Down Expand Up @@ -407,6 +414,19 @@ protected function addPubPath(): bool
return true;
}

/**
* Scope a query to only include popular users.
*
* @return bool
*/
protected function removePreviousMigrations(): bool
{
if (!shell_exec("rm ".database_path('migrations' . DIRECTORY_SEPARATOR)."*")) {
return false;
}
return true;
}

/**
* Scope a query to only include popular users.
*
Expand Down

0 comments on commit dd21137

Please sign in to comment.