I am currently working on a Symfony project and the code is inside a git
repo. We work in a one story/one branch basis and don't push code until we get a code review.
Before asking, I want to say that a working solution (already tried locally) is to merge one of the branches into the one I am currently working but I cannot do that due to processes.
So, that being said, here is my problem:
In one branch I configured my doctrine database in this way:
doctrine:
dbal:
default_connection: default
types:
point: Phil\GeolocationBundle\ORM\PointType
connections:
default:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
mapping_types: { point: point }
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
dql:
numeric_functions:
POINTSTR: Phil\GeolocationBundle\ORM\PointStr
DISTANCE: Phil\GeolocationBundle\ORM\Distance
phil_geolocation:
default:
latitude: 40.7388655
longitude: -73.9830327
city: New York
This is working fine and if I try to generate a migration file, it is generated without any problem.
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
When I try to generate a migration in this branch, I get the following error:
[Doctrine\DBAL\DBALException]
Unknown database type point requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
The weird fact is that this started to happen after I worked in the other branch and, as I said at the beginning, if I merge the working branch into the non-working one, migration files is generated OK.
I tried obvious things like cleaning symfony cache (both dev and prod environments, just in case), updating composer files (because the first configuration was added by a component I needed to use, so in my second branch it was removed), checking other config files like config-dev.yml
and so, just to double check I wasn't missing something. I even hard deleted my cache directories.
I am running out of ideas about what can be happening, it is like if it was cacheing my config file somehow, but it should be impossible!
I found this post, but it is not what is happening to me.
Did you run doctrine:migrations:execute —down yourmigrationnumber
before moving from one branch to another?
Your database is on a different state (from the other branch) so if you run a new migration without executing the down()
method before it will try to create a migration file removing the old state before with that type that doesn't know how to handle it.
Let me know if that helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.