I’ve just imported a project in Symfony v7.1 that I’ve made on another computer from github.
As usual, I ran composer install, but I’m always falling on this issue :
Unknown database ‘my_db’
So I was like "Ah okay ! let’s just create it with doctrine:database:create", same issue :
Unknown database ‘my_db’
I thought "Okay, it might be acting weid for no reason; let’s try something else " so I made a db ‘my_db’ and tried doctrine:schema:create, gave me :
SQLSTATE[42S02]: Base table or view not found: ‘users’
"Oh okay ! I might create this table with a dummy column then" :
Column not found: 1054 Unknown column ‘d0_.city’ in ‘field list’
After trying many commands, as build-schema, schema:update –force, nothings seems to be working, it seems to be "stuck" on these exceptions.
I’m working on a large database so I can’t rewrite it.
Already tried migrate:diff too, dump-sql too, I’m probably not doing it the good way
2
Answers
Just find out why ! I was having a service, with autowiring parameters. After commenting all my service, I've been able to create the schema.
Did you try looking in your .env file?
You should have found a line like :
You need to remove the # and configure YOUR server configuration ( mysql or mariadb .. )
Then create your database with :
and then import the schema into your database using :
php bin/console doctrine:migration:migrate
orphp bin/console doctrine:schema:update --force