Skip to content

Commit 896af3d

Browse files
committed
Revert making attribute nullable
1 parent 882403b commit 896af3d

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

migrations/DoctrineMigrations/Version20260315000001.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525
/**
2626
* Change to the consent schema
2727
* 1. Added the `attribute_stable` column, string(80), nullable
28-
* 2. Changed the `attribute` column, has been made nullable
2928
*/
3029
final class Version20260315000001 extends AbstractEngineBlockMigration
3130
{
3231
public function getDescription(): string
3332
{
34-
return 'Add attribute_stable column to consent table and make attribute nullable';
33+
return 'Add attribute_stable column to consent table';
3534
}
3635

3736
public function preUp(Schema $schema): void
@@ -41,14 +40,11 @@ public function preUp(Schema $schema): void
4140

4241
public function up(Schema $schema): void
4342
{
44-
$this->addSql('ALTER TABLE consent ADD attribute_stable VARCHAR(80) DEFAULT NULL, CHANGE attribute attribute VARCHAR(80) DEFAULT NULL');
43+
$this->addSql('ALTER TABLE consent ADD attribute_stable VARCHAR(80) DEFAULT NULL');
4544
}
4645

4746
public function down(Schema $schema): void
4847
{
49-
$this->warnIf(true, 'This migration is not reversible without deleting all migrated consent hashes.' .
50-
' Manually run `DELETE FROM consent WHERE attribute IS NOT NULL` to delete all migrated consent hashes.');
51-
$this->addSql('ALTER TABLE consent CHANGE attribute attribute VARCHAR(80) NOT NULL');
5248
$this->addSql('ALTER TABLE consent DROP attribute_stable');
5349
}
5450
}

src/OpenConext/EngineBlockBundle/Authentication/Entity/Consent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Consent
5656
/**
5757
* @var string
5858
*/
59-
#[ORM\Column(type: Types::STRING, length: 80, nullable: true)]
59+
#[ORM\Column(type: Types::STRING, length: 80, nullable: false)]
6060
public ?string $attribute = null;
6161

6262
/**

0 commit comments

Comments
 (0)