Skip to content

Commit 00a4623

Browse files
committed
Add the attribute_stable column to consent
1 parent 56c8f43 commit 00a4623

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace OpenConext\EngineBlock\Doctrine\Migrations;
4+
5+
use Doctrine\DBAL\Schema\Schema;
6+
use Doctrine\Migrations\AbstractMigration;
7+
8+
/**
9+
* Change to the consent schema
10+
* 1. Added the `attribute_stable` column, string(80), not null
11+
* 2. Changed the `attribute` column, has been made nullable
12+
*/
13+
final class Version20220503092351 extends AbstractMigration
14+
{
15+
public function up(Schema $schema) : void
16+
{
17+
// this up() migration is auto-generated, please modify it to your needs
18+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
19+
20+
$this->addSql('ALTER TABLE consent ADD attribute_stable VARCHAR(80) NOT NULL, CHANGE attribute attribute VARCHAR(80) DEFAULT NULL');
21+
}
22+
23+
public function down(Schema $schema) : void
24+
{
25+
// this down() migration is auto-generated, please modify it to your needs
26+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
27+
28+
$this->addSql('ALTER TABLE consent DROP attribute_stable, CHANGE attribute attribute VARCHAR(80) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`');
29+
}
30+
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ class Consent
6060
/**
6161
* @var string
6262
*
63-
* @ORM\Column(type="string", length=80)
63+
* @ORM\Column(type="string", length=80, nullable=true)
6464
*/
6565
public $attribute;
6666

67+
/**
68+
* @var string
69+
*
70+
* @ORM\Column(type="string", length=80)
71+
*/
72+
public $attributeStable;
73+
6774
/**
6875
* @var string
6976
*

0 commit comments

Comments
 (0)