DoctrineExtensions
DoctrineExtensions copied to clipboard
[Timestampable] not-null violation on create
Hi, We get not-null sql violation from time to time when one specific entity is created. It is happening randomly without any obvious pattern.
Entity is table inheritance with
#[ORM\InheritanceType(value: 'SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'discr', type: Types::STRING)]
#[ORM\DiscriminatorMap([.....])
//...
#[ORM\Column(name: 'created_at', type: Types::DATETIMETZ_IMMUTABLE, nullable: false)]
#[Gedmo\Timestampable(on: 'create')]
private DateTimeImmutable $createdAt;
#[ORM\Column(name: 'updated_at', type: Types::DATETIMETZ_IMMUTABLE, nullable: false)]
#[Gedmo\Timestampable(on: 'update')]
private DateTimeImmutable $updatedAt;
It happen on production with following prod specific config for doctrine (i think it is default for symfony 6.x):
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
metadata_cache_driver:
type: pool
pool: cache.doctrine_metadata
query_cache_driver:
type: pool
pool: cache.doctrine_query
result_cache_driver:
type: pool
pool: cache.doctrine_result
i recall it started after switching to php attributes with Symfony 5.3+-. Right now app is Symfony 6.2 and it continue to appear as randomly as before.
Fix which i apply is to flush redis database holding prod caches + execute CLI commands which should do the same + restart all messenger workers so they get new cache / empty cache.
I have no idea what is wrong or where to start debug for last 6+ months.
Database is postgresql 14.x
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Looks to be a duplicate of https://github.com/hyraiq/topcat/pull/8870
We are getting similar problems - it only happens with one entity and doesn't happen every time a new entity is created. Very puzzling.
More details here: https://github.com/doctrine-extensions/DoctrineExtensions/issues/2600
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.