0
votes

I'm having an issue with the doctrine:migrations:migrate. I ran a version called " 20190819021520" a few days ago and worked just fine. Database was updated and had no issues. Today I'm trying to do another migration and it is trying to do 20190819021520 again and of course throws errors saying the table column already exists bla bla bla. Of course it exist, the 20190819021520 was ran successfully already. How do i fix this? The migration_versions table even has 20190819021520 entered into it. Any way to just ignore/delete 20190819021520 migration location without it trying to undo on the mysql database?

Here is my output:

php bin/console doctrine:migrations:migrate

                Application Migrations

WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)y Migrating up to 20190822165848 from 20190822165301

++ migrating 20190819021520

 -> ALTER TABLE job_contact CHANGE email email VARCHAR(255) DEFAULT NULL, CHANGE phone phone VARCHAR(255) DEFAULT NULL, CHANGE fax

fax VARCHAR(255) DEFAULT NULL -> ALTER TABLE job_location CHANGE zip zip VARCHAR(15) DEFAULT NULL, CHANGE route route VARCHAR(255) DEFAULT NULL, CHANGE street_number street_number VARCHAR(255) DEFAULT NULL -> ALTER TABLE job_post CHANGE job_location_id job_location_id INT DEFAULT NULL, CHANGE job_contact_id job_contact_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE specialist specialist VARCHAR(255) DEFAULT NULL, CHANGE board_cert board_cert VARCHAR(255) DEFAULT NULL, CHANGE expire_date expire_date DATETIME DEFAULT NULL, CHANGE company_name company_name VARCHAR(255) DEFAULT NULL -> ALTER TABLE user ADD company_name VARCHAR(255) DEFAULT NULL, ADD company_location JSON DEFAULT NULL COMMENT '(DC2Type:json_array)', CHANGE roles roles JSON DEFAULT NULL COMMENT '(DC2Type:json_array)' Migration 20190819021520 failed during Execution. Error An exception occurred while executing 'ALTER TABLE user ADD company_name VARCHAR(255) DEFAULT NULL, ADD company_location JSON DEFAULT NULL COMMENT '(DC2Type:json_array)', CHANGE roles roles JSON DEFAULT NULL COMMENT '(DC2Type:json_array)'':

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'company_name'

In AbstractMySQLDriver.php line 65:

An exception occurred while executing 'ALTER TABLE user ADD company_name VARCHAR(255) DEFAULT NULL, ADD company_location JSON DEFAULT NULL COMMENT '(DC2Type:json_array)', CHANGE roles roles
JSON DEFAULT NULL COMMENT '(DC2Type:json_array)'':

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'company_name'

In PDOConnection.php line 90:

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'company_name'

In PDOConnection.php line 88:

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'company_name'

Any way I can just skip 20190819021520 since it was already completed a few days ago?

1

1 Answers

1
votes

You should try to add it to migration_versions table with command:

$ php bin/console doctrine:migrations:version 20190819021520 --add

https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html#skipping-migrations