Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating migrations table using Oracle fails #788

Open
bobvandevijver opened this issue Feb 3, 2019 · 7 comments
Open

Updating migrations table using Oracle fails #788

bobvandevijver opened this issue Feb 3, 2019 · 7 comments

Comments

@bobvandevijver
Copy link
Contributor

bobvandevijver commented Feb 3, 2019

Bug Report

Q A
BC Break no
Version 2.0

Summary

The new executed_at column as introduced in #675 (awesome feature btw!) unfortunately breaks migrations on Oracle databases as the SQL statement generated to update the migrations table is incorrect.

ALTER TABLE MIGRATION_VERSIONS ADD (version VARCHAR2(14) NOT NULL, executed_at TIMESTAMP(0) DEFAULT NULL NULL)

As you can see, it tries to re-add the already existing table (which is missing the executed_at column), which obviously then fails with:

ORA-01430: column being added already exists in table

Note we've also just updated several MariaDB and Postgres servers without any issue, so it seems that only Oracle is affected.

Current behavior

Migrations are broken when using an Oracle database (until manual intervention)

How to reproduce

Remove the executed_at table if you have one, and run (using the Symfony migrations bundle for integration):

php bin/console doctrine:migrations:status

Expected behavior

No errors 😄

@jwage
Copy link
Member

jwage commented Feb 3, 2019

Why does that column already exist? Did you add it manually. I don't have a way to test against Oracle easily. Can you help triage the problem?

@bobvandevijver
Copy link
Contributor Author

I'm afraid you read the message wrong: Oracle warns about the version column already being there (which is and should be, as we upgraded from 1.8). The generated SQL to add the executed_at column also tries to add the version column, which is indeed invalid.

I can test, but I unfortunately do not have much time to spare to find the actual cause.

@SenseException
Copy link
Member

@bobvandevijver Which version of Oracle DB is in use?

@bobvandevijver
Copy link
Contributor Author

bobvandevijver commented Feb 3, 2019

I've now seen it on these two versions:

  • Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  • Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

@jwage
Copy link
Member

jwage commented Feb 3, 2019

If you manually add the new columns to the table, does Doctrine stop trying to update the table?

@bobvandevijver
Copy link
Contributor Author

Yes, if I manually add the executed_at column it stops complaining and it then works as I would expect. Tried mentioning that in the original post, but that might not have been as clear as I thought :)

@hmonglee
Copy link

hmonglee commented Jun 7, 2019

Hello I have the same issue with Oracle. I made a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants