Detect default values that are functions with parameters #589
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.
Hi. Thanks again for all your work on this.
It looks like the changes in 0.8.5 didn't quite resolve issue #548 :
We have a column with default value
(EXTRACT( MICROSECOND FROM NOW(3)) / 1000)
. Sequelize-auto currently generates invalid JS/TS in its output (though much nicer than before):This stems from line 369 in auto-generator.js:
which only matches parentheses with nothing between them. This PR just changes the regex to
/\([\w ]*\)/g
so that it matches on parentheses with alphanumeric characters and/or spaces between them, and an equivalent change on line 377.It may be appropriate to use an even more permissive regex - for example,
/\([\w ,]*\)/g
would also match functions with multiple arguments. I'm not familiar enough with the functions of the different RDBMSs that Sequelize supports to devise the ideal regex, but this adjustment should add functionality without breaking anything.