Symfony2 Doctrine schema update fails

前端 未结 5 1277
不知归路
不知归路 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:52

    Your problem is that you want to modify a table with existing constraint. I see two solutions:

    If you are in dev, you can rebuild your database

    doctrine:database:drop --force
    doctrine:database:create
    doctrine:schema:create
    

    If you're in production it's a little more complicated.

    One solution I see is that you could create a command to save your data, delete the data in the tables you want to alter, modify your schema, reload the data once your table is altered. Depending on the changes, it shouldn't take more then 2-3 hours. Just make sure you have a backup in case your command goes south.

提交回复
热议问题