Repository navigation
fix(query-generator): fix addColumn create comment - #10117
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10117 +/- ##
==========================================
- Coverage 96.37% 96.33% -0.05%
==========================================
Files 63 63
Lines 9411 9431 +20
==========================================
+ Hits 9070 9085 +15
- Misses 341 346 +5
Continue to review full report at Codecov.
|
sushantdhiman
left a comment
There was a problem hiding this comment.
LGTM, just a small change
|
Thanks @mirkojotic |
| if (option && option.context === 'addColumn') { | ||
| const quotedAttr = this.quoteIdentifier(option.key); | ||
| const escapedCommentText = this.escape(attribute.comment); | ||
| sql += `; COMMENT ON COLUMN ${this.quoteTable(option.table)}.${quotedAttr} IS ${escapedCommentText}`; |
There was a problem hiding this comment.
Is this feature working?
I need to put some comments into a column to let know others devs of a team a small description of what's the purpose of the column.
There was a problem hiding this comment.
@normancarcamo It was merged into master but you'll have to see which version of sequelize it will land in.
But also this is just the the addition to a PR merged a couple of months back that allowed this to be done on table creation. This PR is just so you could leverage this feature on addColumn API of query generator.
| dataType.field = key; | ||
| let commentStr = ''; | ||
|
|
||
| if (dataType.comment && _.isString(dataType.comment)) { |
There was a problem hiding this comment.
Post merge comment: Should use typeof
There was a problem hiding this comment.
@SimonSchick Agreed. I was trying to be consistent with the rest of the codebase and lodash is already imported and used.
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
Resolves #4386
More specifically #4386 (comment)
This adds on the work @theRichu started around adding an ability to add a comment while using
addColumnAPI.Initial PR can be found here
#10076