Skip to content

Commit 613e9d1

Browse files
committed
Fix mapping issue with consent.deleted_at
Prior to this change, the production schema would differ from the Doctrine mapping. On prod, deleted_at was `NOT NULL, default=0000-00-00 00:00:00`. This is correct, as it is part of the primary key, and cannot be null. This change corrects the mapping to align with production. See #1906
1 parent 764bba4 commit 613e9d1

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Upgrade to `doctrine/dbal` 4
1818
Bugfixes:
1919
* Metadata push will now reject all metadata if any service contains invalid PHP syntax in its attribute manipulations (#1778)
2020

21+
Changes:
22+
* The `consent.deleted_at` should be not nullable, and have a default value of `0000-00-00 00:00:00`.
23+
* Because `deleted_at` is part of the PK, no migration is provided. The database engine should not allow this to be null in the first place, so it is probably not nullable already on your db.
24+
* The `0000-00-00 00:00:00` is added for clarity/consistency, as this is probably the default behaviour of your database already.
25+
* Removed unused index `consent.deleted_at`. Delete this from your production database if it's there.
26+
2127
## 7.1.0
2228
SRAM integration
2329

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ class Consent
7070
* @var DateTime
7171
*/
7272
#[ORM\Id]
73-
#[ORM\Column(name: 'deleted_at', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
73+
#[ORM\Column(name: 'deleted_at', type: Types::DATETIME_MUTABLE, nullable: false, options: ['default' => '0000-00-00 00:00:00'])]
7474
public ?DateTimeInterface $deletedAt = null;
7575
}

0 commit comments

Comments
 (0)