Skip to content

Commit

Permalink
Always overwrite schema file
Browse files Browse the repository at this point in the history
  • Loading branch information
raul338 committed Apr 20, 2021
1 parent aec3151 commit be4e98f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Command/SchemaSaveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
];
$this->tables = $this->_describeTables($args, $io);

$filePath = $this->getPath($args) . $this->fileName('schema');
if (file_exists($filePath)) {
unlink($filePath);
}

parent::bake('schema', $args, $io);

return self::CODE_SUCCESS;
Expand Down
3 changes: 2 additions & 1 deletion tests/TestCase/Command/SchemaCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public function testSchemaSave(): void
public function testSchemaSaveOverwriteFile(): void
{
$this->runMigrations();
$this->exec('schema save -c test', ['y']);
$this->assertTrue(touch(CONFIG . 'schema.php'), 'Could not create dummy file');
$this->exec('schema save -c test');
$this->assertExitSuccess();
$this->assertValidSchemaFile();
}
Expand Down

0 comments on commit be4e98f

Please sign in to comment.