Symfony2 Doctrine schema update fails

前端 未结 5 1281
不知归路
不知归路 2021-02-07 11:53

I created database on my local machine. After moving my project to server I imported backup from local (because I had some important data there).

Now,when I\'m trying t

5条回答
  •  耶瑟儿~
    2021-02-07 12:50

    @maxian

    Michael Villeneuve answer is not totally right. In case of a production environnement or kind of , you just can t drop schema and recreate it.

    The only way to perform it on your current schema is by the followings :

    1. php app/console doctrine:schema:update --dump-sql . Copy the ouptut. Its the direct SQL queries to update your schema
    2. connect mysql with mysql command line or through a mysql client
    3. Disable foreign keys checking by call this query : "set foreign_key_checks=0;"
    4. put the queries from doctrine:schema:update
    5. Enable back foreign key checking with : "set foreign_key_checks=1;"

    i cannot guarantee you won t lost some keys but you don t drop your datas at all .

提交回复
热议问题