Skip to content

Commit

Permalink
Merge pull request #738 from cakephp/builtin-default
Browse files Browse the repository at this point in the history
Make builtin the default migrations backend
  • Loading branch information
markstory authored Aug 21, 2024
2 parents c810685 + dc6edfc commit 6047ee0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Command/EntryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function run(array $argv, ConsoleIo $io): ?int

// This is the variance from Command::run()
if (!$args->getArgumentAt(0) && $args->getOption('help')) {
$backend = Configure::read('Migrations.backend', 'phinx');
$backend = Configure::read('Migrations.backend', 'builtin');
$io->out([
'<info>Migrations</info>',
'',
Expand Down
1 change: 1 addition & 0 deletions src/Command/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
'help' => "Mark any migrations selected as run, but don't actually execute them",
'boolean' => true,
])->addOption('dry-run', [
'short' => 'x',
'help' => 'Dump queries to stdout instead of executing them',
'boolean' => true,
])->addOption('no-lock', [
Expand Down
2 changes: 1 addition & 1 deletion src/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getCommand(): string
*/
protected function getBackend(): BuiltinBackend|PhinxBackend
{
$backend = (string)(Configure::read('Migrations.backend') ?? 'phinx');
$backend = (string)(Configure::read('Migrations.backend') ?? 'builtin');
if ($backend === 'builtin') {
return new BuiltinBackend($this->default);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MigrationsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function bootstrap(PluginApplicationInterface $app): void
parent::bootstrap($app);

if (!Configure::check('Migrations.backend')) {
Configure::write('Migrations.backend', 'phinx');
Configure::write('Migrations.backend', 'builtin');
}
}

Expand Down
23 changes: 1 addition & 22 deletions tests/TestCase/Command/CompletionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,12 @@ public function testMigrationsSubcommands()
{
$this->exec('completion subcommands migrations.migrations');
$expected = [
'dump mark_migrated migrate orm-cache-build orm-cache-clear create rollback seed status',
'dump mark_migrated migrate rollback seed status',
];
$actual = $this->_out->messages();
$this->assertEquals($expected, $actual);
}

/**
* Test that subcommands from the Migrations shell are correctly returned
* if needed with the autocompletion feature
*
* @return void
*/
public function testMigrationsOptionsCreate()
{
$this->exec('completion options migrations.migrations create');
$this->assertCount(1, $this->_out->messages());
$output = $this->_out->messages()[0];
$expected = '--class -l --connection -c --help -h --path --plugin -p --quiet';
$expected .= ' -q --source -s --template -t --verbose -v';
$outputExplode = explode(' ', trim($output));
sort($outputExplode);
$expectedExplode = explode(' ', $expected);
sort($expectedExplode);

$this->assertEquals($outputExplode, $expectedExplode);
}

/**
* Test that subcommands from the Migrations shell are correctly returned
* if needed with the autocompletion feature
Expand Down

0 comments on commit 6047ee0

Please sign in to comment.