carsonbot: Cannot create task after upgrading Doctrine

This error shows up in the log:

app.ERROR: Failed dispatching “pull_request” event for “carsonbot-playground/symfony” repository. {“exception”:"[object] (Doctrine\DBAL\Exception\NotNullConstraintViolationException(code: 0): An exception occurred while executing ‘INSERT INTO task (repository_full_name, number, action, created_at, updated_at, verify_after) VALUES (?, ?, ?, ?, ?, ?)’ with params ["carsonbot-playground\/symfony", 22, 4, "2021-05-31 14:10:11", "2021-05-31 14:10:11", "2021-06-01 10:10:11"]:\n\nSQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint\nDETAIL: Failing row contains (null, carsonbot-playground/symfony, 22, 4, 2021-05-31 14:10:11, 2021-05-31 14:10:11, 2021-06-01 10:10:11). at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php:64)\n[previous exception] [object] (Doctrine\DBAL\Driver\PDO\Exception(code: 23502): SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates

Here is the only place we create a Task:


This error was fixed by PR #181. It just downgraded doctrine packages.

  - Removing doctrine/deprecations (v0.5.3)
  - Downgrading doctrine/common (3.1.2 => 3.0.2)
  - Downgrading doctrine/dbal (2.13.1 => 2.10.4)
  - Downgrading doctrine/doctrine-bundle (2.3.2 => 2.2.1)
  - Downgrading doctrine/inflector (2.0.3 => 1.4.4)
  - Downgrading doctrine/migrations (3.1.2 => 3.1.1)
  - Downgrading doctrine/orm (2.8.4 => 2.7.4)

Let’s update them one by one.

  • Upgrade to doctrine/common 3.1.2
  • Upgrade to doctrine/dbal 2.13.1
  • Upgrade to doctrine/doctrine-bundle 2.3.2
  • Upgrade to doctrine/inflector 2.0.3
  • Upgrade to doctrine/migrations 3.1.2
  • Upgrade to doctrine/orm 2.8.4

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

and so, the solution for that is either to put a postgresql URL in the .env for the fallback value, or maybe to set the driver explicitly in YAML (but maybe the fake URL from .env will still win, not sure).

@Nyholm can you try configuring the db driver and server versions explicitly in the DBAL config instead of extracting them from the credentials URL ? DoctrineBundle 2.3.0 introduces a new metadata caching configuration that automatically cache the mapping during the cache-warmup (enabled only in non-debug mode, which might explain why you don’t see the issue in dev). If you run the cache-warmup without the DB credentials in the env variables, the ORM might receive the wrong DB platform when generating the metadata, which would cache the wrong metadata (and so potentially break things)