diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 10679d2e0..d3eee0b2a 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -140,6 +140,7 @@ class Address /** * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") + * @ORM\JoinColumn(nullable=false) * @Groups({"write"}) */ private ?PostalCode $postcode = null; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220413225830.php b/src/Bundle/ChillMainBundle/migrations/Version20220413225830.php new file mode 100644 index 000000000..43ef753bb --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20220413225830.php @@ -0,0 +1,27 @@ +addSql('ALTER TABLE chill_main_address ALTER COLUMN postcode_id SET NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_address ALTER COLUMN postcode_id DROP NOT NULL'); + + } +} diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220413230159.php b/src/Bundle/ChillMainBundle/migrations/Version20220413230159.php new file mode 100644 index 000000000..7a2ce476b --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20220413230159.php @@ -0,0 +1,26 @@ +addSql('ALTER TABLE chill_main_address ADD CONSTRAINT chill_custom_validfrom_before_validto CHECK (validfrom <= COALESCE(validto, \'infinity\'::date))'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_main_address DROP CONSTRAINT chill_custom_validfrom_before_validto'); + } +}