Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Require SQL comment hint #14

Merged
merged 1 commit into from Dec 6, 2017
Merged

Require SQL comment hint #14

merged 1 commit into from Dec 6, 2017

Conversation

ossinkine
Copy link
Contributor

Doctrine can't detect field type with no comment hint when get schema from DB.
For example, Doctrine creates migration with changing field type even if field type is already correct.

@acelaya
Copy link
Owner

acelaya commented Dec 5, 2017

I think I don't follow you. Could you provide an example?

ossinkine added a commit to ossinkine/symfony-standard that referenced this pull request Dec 5, 2017
@ossinkine
Copy link
Contributor Author

ossinkine commented Dec 5, 2017

See https://github.com/ossinkine/symfony-standard/tree/reproducer-acelaya-doctrine-enum-type-14
This is Symfony Standard 3.3 with installed Doctrine migrations bundle and this library according to readme.
Steps to reproduce:

  1. Run composer install
  2. Run docker-compose up -d
  3. Run docker-compose exec php bin/console doctrine:migrations:diff. The following SQL is generated:
CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
CREATE TABLE users (id INT NOT NULL, name VARCHAR(255) NOT NULL, gender VARCHAR(255) NOT NULL, PRIMARY KEY(id));
  1. Run docker-compose exec php bin/console doctrine:migrations:migrate
  2. Run docker-compose exec php bin/console doctrine:migrations:diff again. The following SQL is generated:
ALTER TABLE users ALTER gender TYPE VARCHAR(255);
ALTER TABLE users ALTER gender DROP DEFAULT;

@ossinkine
Copy link
Contributor Author

This reproducer for Postgres driver, MySQL driver has the same behavior

@acelaya
Copy link
Owner

acelaya commented Dec 6, 2017

Wow! Thanks for the detailed information.

I have been researching, and this update makes sense. I didn't know about this feature.

In fact I'm going to consider it a hotfix and release v2.0.3

Thank you very much for your help :-)

@acelaya acelaya merged commit 1130efe into acelaya:master Dec 6, 2017
@acelaya acelaya added the bug label Dec 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants