I'm building a application using Symfony2 + Doctrine2. My application needs to store geospatial data, so I wrote the proper doctrine extensions. All is working pretty good and the app have been running in a production enviroment for a long time.
Now I have to add some new features and I need to update the database without deleting all the data. I thougth about using the DoctrineMigrationBundle but when I run:
$ php app/console doctrine:migrations:status
I got this error:
[Doctrine\DBAL\DBALException]
Unknown database type point requested,
Doctrine\DBAL\Platforms\MySqlPlatform may not
support it.
This is the relevant section of my config.yml:
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
types:
point: App\EngineBundle\DoctrineExtensions\PointType
The custom type 'point' has been mapped, so what am I doing wrong?
The Doctrine Migrations offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and powerful tool. In order to use migrations you need to do some setup first.
Database migrations are a way to safely update your database schema both locally and on production. Instead of running the doctrine:schema:update command or applying the database changes manually with SQL statements, migrations allow to replicate the changes in your database schema in a safe manner.
I answer my own question, it seems the problem is DoctrineMigrations also needs a mapping for the custom type. So the config.yml should look like this:
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
types:
point: App\EngineBundle\DoctrineExtensions\PointType
mapping_types:
point: point
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With