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

fix: support changing comments in MySQL columns #6903

Merged
merged 1 commit into from
Oct 18, 2020

Conversation

imnotjames
Copy link
Contributor

@imnotjames imnotjames commented Oct 13, 2020

in the mysql driver, column comments were only half supported -
adding them to new columns & new tables was possible, but updating
existing columns to include comments was not possible

adds support to add comments to existing columns & creates tests
to verify the behavior

Closes #6336

@imnotjames imnotjames force-pushed the fix/mysql-column-comments branch 3 times, most recently from bbaa826 to 05aa6d3 Compare October 13, 2020 20:40
@pleerock
Copy link
Member

It's super important for us to avoid breaking changes, and changes in schema sync are the most dangerous ones. That's why I'm always super dangerous on merging such PRs. Please make sure to check schema sync under different circumstances before merging it.

in the mysql driver, column comments were only half supported -
adding them to new columns & new tables was possible, but updating
existing columns to include comments was not possible

there also was no escaping done on the column comments - so depending
on the contents of your comment, an invalid query could be generated

adds support to add comments to existing columns, adds simple comment
escaping code, & creates tests to verify the behavior
@imnotjames
Copy link
Contributor Author

Entirely agree. There's a number of edge cases tested here and the only code path that's not being a comments changing test should be safe.

I've tested various possible failure states and also changing the comments. There's existing tests that test changing columns without changing comments.

Nothing is 100% safe, but these new tests help bring that % up a bit :)

@imnotjames imnotjames merged commit c5143aa into typeorm:master Oct 18, 2020
@imnotjames imnotjames deleted the fix/mysql-column-comments branch October 18, 2020 16:34
@imnotjames imnotjames added the hacktoberfest-accepted label hacktoberfest label Oct 19, 2020
zaro pushed a commit to zaro/typeorm that referenced this pull request Jan 12, 2021
in the mysql driver, column comments were only half supported -
adding them to new columns & new tables was possible, but updating
existing columns to include comments was not possible

there also was no escaping done on the column comments - so depending
on the contents of your comment, an invalid query could be generated

adds support to add comments to existing columns, adds simple comment
escaping code, & creates tests to verify the behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted label hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants