Closed Atala closed 7 years ago
Could you provide a little bit background of your setup, at best a minimal reproducible test case? Are you using it with a framework, eg. Symfony?
Hi!
I'm seeing this error too. I created a repo to showcase the issue with Symfony 3.3 at https://github.com/reskume/doctrine-postgis-31. If i run:
php bin/console doctrine:schema:drop --force && php bin/console doctrine:schema:create && php bin/console doctrine:schema:validate
the output is
Dropping database schema...
Database schema dropped successfully!
ATTENTION: This operation should not be executed in a production environment.
Creating database schema...
Database schema created successfully!
[Mapping] OK - The mapping files are correct.
[Database] FAIL - The database schema is not in sync with the current mapping file.
The dumped SQL from schema update tool is also, as mentioned above
COMMENT ON COLUMN poi.geometry IS '(DC2Type:geometry)';
@reskume Thanks for the setup, it helped tracking it down. You need to explicitly define the types as not commented in config.yml
doctrine:
dbal:
types:
geography:
class: 'Jsor\Doctrine\PostGIS\Types\GeographyType'
commented: false
geometry:
class: 'Jsor\Doctrine\PostGIS\Types\GeometryType'
commented: false
raster:
class: 'Jsor\Doctrine\PostGIS\Types\RasterType'
commented: false
I'm going to update the documentation.
Btw, it is usually not required to manually register the DBAL types in the config und you can also just remove it.
Thanks @jsor for the quick workaround!
@jsor is this a workaround and you (or doctrine maintainers) are going to issue a permanent fix?
Thanks for your quick answer!
No, this is just the correct way to configure the types in Symfony. For whatever reason, Symfony overwrites the commented
configuration of the registered types.
But as i said, you usually don't need to register the types manually. I've update the section in the README in 9bfbcc6072067d0788fed476de8866d2a6501047.
I think this issues has been resolved. Feel free to reopen if needed.
Hey,
I am not sure if it's the correct place to ask for this, so correct me if I am wrong.
When using
bin/console doctrine:schema:update
to validate the schema, doctrine always returns[Database] FAIL - The database schema is not in sync with the current mapping file
.If I run
bin/console doctrine:schema:update --dump-sql
to see what's wrong, I always get the followingCOMMENT ON COLUMN address.geo IS '(DC2Type:geography)';
.Not sure if it's an issue with doctrine or doctrine-postgis - could you help me on this?