Skip to content

Commit 58ee273

Browse files
committed
Add pruned property to package version entity
1 parent 8a1280e commit 58ee273

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 Version20260416081737 extends AbstractMigration
11+
{
12+
public function getDescription(): string
13+
{
14+
return '';
15+
}
16+
17+
public function up(Schema $schema): void
18+
{
19+
$this->addSql(<<<'SQL'
20+
ALTER TABLE version ADD pruned BOOLEAN DEFAULT NULL
21+
SQL);
22+
$this->addSql(<<<'SQL'
23+
UPDATE version SET pruned = false
24+
SQL);
25+
$this->addSql(<<<'SQL'
26+
ALTER TABLE version ALTER pruned SET NOT NULL
27+
SQL);
28+
}
29+
30+
public function down(Schema $schema): void
31+
{
32+
$this->addSql(<<<'SQL'
33+
ALTER TABLE version DROP pruned
34+
SQL);
35+
}
36+
}

src/Doctrine/Entity/Version.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class Version extends TrackedEntity implements \Stringable
2323
#[ORM\Column]
2424
private bool $development;
2525

26+
#[ORM\Column]
27+
private bool $pruned = false;
28+
2629
#[ORM\Column]
2730
private bool $defaultBranch = false;
2831

@@ -91,6 +94,16 @@ public function setDevelopment(bool $development): void
9194
$this->development = $development;
9295
}
9396

97+
public function isPruned(): bool
98+
{
99+
return $this->pruned;
100+
}
101+
102+
public function setPruned(bool $pruned): void
103+
{
104+
$this->pruned = $pruned;
105+
}
106+
94107
public function isDefaultBranch(): bool
95108
{
96109
return $this->defaultBranch;

0 commit comments

Comments
 (0)