Skip to content

Commit 2d2c354

Browse files
committed
Add database migration to convert the vcs package fetch strategy to source to preserve behavior of existing packages
1 parent b82956d commit 2d2c354

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
final class Version20260713143513 extends AbstractMigration
11+
{
12+
public function getDescription(): string
13+
{
14+
return 'Convert the vcs package fetch strategy to source to preserve behavior of existing packages';
15+
}
16+
17+
public function up(Schema $schema): void
18+
{
19+
// Previously the vcs fetch strategy used the default Composer drivers (using APIs where
20+
// possible), which is now the behavior of the source fetch strategy. The vcs fetch
21+
// strategy now always clones repositories instead.
22+
$this->addSql(<<<'SQL'
23+
UPDATE package SET fetch_strategy = 'source' WHERE fetch_strategy = 'vcs'
24+
SQL);
25+
// Packages without a fetch strategy or mirror registry fell back to the vcs fetch strategy.
26+
$this->addSql(<<<'SQL'
27+
UPDATE package SET fetch_strategy = 'source' WHERE fetch_strategy IS NULL AND mirror_registry_id IS NULL
28+
SQL);
29+
}
30+
31+
public function down(Schema $schema): void
32+
{
33+
$this->addSql(<<<'SQL'
34+
UPDATE package SET fetch_strategy = 'vcs' WHERE fetch_strategy = 'source'
35+
SQL);
36+
}
37+
}

0 commit comments

Comments
 (0)