-
Notifications
You must be signed in to change notification settings - Fork 418
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
Don't null size field when scale specified #621
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an issue that I come upon using propel migration. It always tried to migrate my decimal column with the same values. After inspecting closely I have figured that reverse schema parser sets null to $size variable (even if $scale) is specified. This way, when migrator compares columns it has $size = 10 in schema.xml and $size = null in database (because reverse mysql class changes native sizes to null). Real life example: XML: latitude: { phpName: Latitude, type: DECIMAL, size: 10, scale: 7, required: false } DB: `latitude` decimal(10,7) DEFAULT NULL, produces migration queries as such: getUpSQL: ALTER TABLE `venues` CHANGE `latitude` `latitude` DECIMAL(10,7); getDownSQL: ALTER TABLE `venues` CHANGE `latitude` `latitude` DECIMAL; even though database is already set propely with size and scale.
You have an parse error in your PR. you should add a failing unit-test before fixing the issue. |
why don't you add the test to the test-suite with this PR? |
@fliespl the tests are not green anymore... are you willing to have another look into it? |
Could you please explain what should I do? |
jaugustin
added a commit
that referenced
this pull request
Mar 10, 2013
jaugustin
added a commit
that referenced
this pull request
Mar 10, 2013
Don't null size field when scale specified
@fliespl I merged your PR thanks I modified your tests to make them work ;) |
@jaugustin thanks for both tests and merge :) |
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an issue that I come upon using propel migration. It always tried to migrate my decimal column with the same values.
After inspecting closely I have figured that reverse schema parser sets null to $size variable (even if $scale) is specified.
This way, when migrator compares columns it has $size = 10 in schema.xml and $size = null in database (because reverse mysql class changes native sizes to null).
Real life example:
XML:
latitude: { phpName: Latitude, type: DECIMAL, size: 10, scale: 7, required: false }
DB:
latitude
decimal(10,7) DEFAULT NULL,produces migration queries as such:
getUpSQL:
ALTER TABLE
venues
CHANGElatitude
latitude
DECIMAL(10,7);getDownSQL:
ALTER TABLE
venues
CHANGElatitude
latitude
DECIMAL;As you can see in getDownSQL, database reverse parser didn't account for size+scale combination and assumed that size is 10,0.