skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


  2. Did you try looking in your .env file?
    You should have found a line like :

    # DATABASE_URL=“mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4”
    

    You need to remove the # and configure YOUR server configuration ( mysql or mariadb .. )

    Then create your database with :

    php bin/console doctrine:database:create 
    

    and then import the schema into your database using :
    php bin/console doctrine:migration:migrate or php bin/console doctrine:schema:update --force

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search