0

I am currently migrating from a legacy project to a Symfony4. So I still need to keep the schema of the database.

I imported the database, and after fixing tons of issues I'm still unable to solve this one :

I have a join column where Doctrine is trying to set default value

$this->addSql('ALTER TABLE temperature_recording_system_sensor ALTER temperature_recording_system_site_uuid SET DEFAULT \'uuid_generate_v4()\'');

My column definition is actually like this :

/**
 * @var TemperatureRecordingSystemSite
 *
 * @ORM\ManyToOne(targetEntity="TemperatureRecordingSystemSite")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="temperature_recording_system_site_uuid", referencedColumnName="temperature_recording_system_site_uuid", nullable=true, columnDefinition="DEFAULT NULL")
 * })
 */
private $temperatureRecordingSystemSiteUuid;

How should I tell Doctrine to not set default values, as I can't use the option field on join column ?

I'm on Postgres 9.6.10 also. Ia not trying to set a default value, plus it's on a JoinColumn, not a Column.

MinDBreaK
  • 153
  • 2
  • 16
  • by *tell Doctrine to not set default values*, do you mean *tell Doctrine to **set** `null` as default value* ? – Cid Sep 27 '18 at 13:58
  • This i actually what I tried, and also by removing the columnDefinition. Nothing changed – MinDBreaK Sep 27 '18 at 14:00
  • Possible duplicate of [Default value in Doctrine](https://stackoverflow.com/questions/3376881/default-value-in-doctrine) – Cid Sep 27 '18 at 14:01
  • @Cid This is actually not a duplicate, please read the definition on the problem – MinDBreaK Sep 27 '18 at 14:04

0 Answers0