migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Changed migrations table name and now it tries to create it every time

Open knifesk opened this issue 6 years ago • 2 comments

Hi, I'm using the lumen migrations for the failed_jobs table... So, I changed the name for the table to "migrations_doctrine" in the config file.. But now each time I try to add a new migration I get errors about:

An exception occurred while executing 'CREATE TABLE migrations_doctrine (version VARCHAR(255) NOT NULL, PRIMARY KEY(version)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB': 
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'migrations_doctrine' already exists      

Should I blacklist migrations_doctrine too?

knifesk avatar Oct 31 '18 01:10 knifesk

Try blacklisting it here: https://github.com/laravel-doctrine/migrations/blob/1.2/config/migrations.php#L59 (even though it should just work out of the box)

patrickbrouwers avatar Oct 31 '18 19:10 patrickbrouwers

I did.. but it didn't work. Apparently the setting is being used for creation, but when the doctrine/migrations library checks if the table exists it fails (because it wouldn't be trying to create it if it were using the "migrations" name), but when it tries to create it uses the correct name (which does exists) and then fails.. I ended up reverting to "migrations" and renamed the lumen's one to "migrations_lumen".. and voila.. everything works as expected...

I think there's a bug on the "check if migrations table_name exists". But I have no time to debug it as the project is demanding me a lot of my attention.. But at least I got it working and maybe someone with better knowledge about the internals of the library can check if that's actually the problem

Thanks @patrickbrouwers for your reply!

FTR: I did copy the ./vendor/..../config/migrations.php default config file to ./config/migrations.php

knifesk avatar Oct 31 '18 20:10 knifesk