diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php index 4016cd833..42c75efca 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php @@ -39,7 +39,7 @@ class Origin private $id; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="json") */ private $label; diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20210419105940.php b/src/Bundle/ChillPersonBundle/migrations/Version20210419105940.php new file mode 100644 index 000000000..4214c7069 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20210419105940.php @@ -0,0 +1,36 @@ +addSql('ALTER TABLE chill_person_accompanying_period_origin ' + . 'ALTER label TYPE JSON USING json_build_object(\'fr\', label)::jsonb'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_origin ' + . 'ALTER label DROP DEFAULT'); + } + + public function down(Schema $schema) : void + { + // this will keep the '"' at first and last character, but is acceptable + $this->addSql('ALTER TABLE chill_person_accompanying_period_origin ' + . 'ALTER label TYPE VARCHAR(255) USING label->\'fr\'::text'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_origin ' + . 'ALTER label DROP DEFAULT'); + } +}