mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 01:09:21 +02:00
Merge branch 'develop' into feature/app-rewrite
This commit is contained in:
commit
550d6910e1
@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## [1.3.1 - 19.03.2025]
|
||||
|
||||
### Fixed
|
||||
* Fixed migrate:run command (https://github.com/slawkens/myaac/commit/1a5771ad51e595fe13368a0721b059c4ecefb17d)
|
||||
|
||||
### Changed
|
||||
* Small adjustments (https://github.com/slawkens/myaac/commit/6fac883659f581baac1361826d046410156f1e58, https://github.com/slawkens/myaac/commit/4a6896b4469968b9904292734cf6c14ba5eeef14)
|
||||
|
||||
## [1.3 - 10.03.2025]
|
||||
|
||||
### Changed
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace MyAAC\Commands;
|
||||
|
||||
use MyAAC\Hooks;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
@ -16,7 +17,10 @@ class CacheClearCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
require SYSTEM . 'init.php';
|
||||
global $hooks;
|
||||
$hooks = new Hooks();
|
||||
$hooks->load();
|
||||
$hooks->trigger(HOOK_INIT);
|
||||
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace MyAAC\Commands;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
@ -16,7 +17,8 @@ class MigrateRunCommand extends Command
|
||||
->addArgument('id',
|
||||
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
|
||||
'Id or ids of migration(s)'
|
||||
);
|
||||
)
|
||||
->addOption('down', 'd', InputOption::VALUE_NONE, 'Down');;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
@ -41,8 +43,10 @@ class MigrateRunCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
$down = $input->getOption('down') ?? false;
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$this->executeMigration($id, $io);
|
||||
$this->executeMigration($id, $io, !$down);
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
@ -52,13 +56,24 @@ class MigrateRunCommand extends Command
|
||||
return file_exists(SYSTEM . 'migrations/' . $id . '.php');
|
||||
}
|
||||
|
||||
private function executeMigration($id, $io): void
|
||||
private function executeMigration($id, $io, $_up = true): void
|
||||
{
|
||||
$db = app()->get('database');
|
||||
|
||||
$db->revalidateCache();
|
||||
|
||||
require SYSTEM . 'migrations/' . $id . '.php';
|
||||
$io->success('Migration ' . $id . ' successfully executed');
|
||||
if ($_up) {
|
||||
if (isset($up)) {
|
||||
$up();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isset($down)) {
|
||||
$down();
|
||||
}
|
||||
}
|
||||
|
||||
$io->success('Migration ' . $id . ' successfully executed' . ($_up ? '' : ' (downgrade)'));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user