3

my problem is I want to use the

php bin/console make:migration
php bin/console doctrine:migrations:migrate

approach of Symfony 4 to update my database instead of using:

php bin/console doctrine:schema:update   --force

which works fine - to say at least.

But when I use migrations I get all the time the following error on the doctrine:migrations:migrate command:

enter image description here

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Slowwie
  • 1,146
  • 2
  • 20
  • 36
  • it literally says right there ... the table you're trying to create already exists. – Jakumi Apr 19 '19 at 11:06
  • yes ok, but when I delete it, it comes again and then, I have the same error. And the ext_translations table is not mine. Its Symfony internal table for translations. – Slowwie Apr 19 '19 at 11:50
  • unless you wrote the migrations yourself, I would advise you remove all migrations (like the files too), and then take care your migrations aren't trying to create tables that are created automatically or that exist beforehand. – Jakumi Apr 19 '19 at 11:53
  • So, its a Symfony bug? - when Symfony wanna create again and again ext_translations table. Should I report it? – Slowwie Apr 19 '19 at 12:03
  • 1
    no, i think your migrations are ... bad. migrations are used to modify the existing database schema to a new schema. your migrations assume there's nothing and try to create existing tables. that's just completely useless. – Jakumi Apr 19 '19 at 12:04
  • My migrations comes from Symfony: php bin/console make:migration – Slowwie Apr 19 '19 at 12:05
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/192101/discussion-between-jakumi-and-slowwie). – Jakumi Apr 19 '19 at 12:06

1 Answers1

4

the make:migration command apparently is meant to create the database schema, when there's none at all. (source)

doctrine:migrations:diff is better suited to create differential migrations.

good luck.

Jakumi
  • 8,043
  • 2
  • 15
  • 32