Improve precision and scale behavior across adapters #2383
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.
PR is a continuation of the work done in #2377, bringing that change across providers as makes sense. As part of this, now:
(p,s)args ifprecisionis not empty and scale is not null, so that doing(10,0)is possible (same as mysql)(p,s)args with an appropriate default of(18,0)(defaults used as defined in the sqlserver decimal docs) is one is omitted. So it's possible to do just'scale' => 5, and then precision will be implicitly set to18, and you'll get(18,5). This brings its behavior in line with how postgres works (though it has a default of10for precision).scaleas well (though it's expected that this will only be defined for numeric types anyway).As part of this, I did learn that under the hood, precision and limit are equivalent for defining a column, which does prevent just using a precision for mysql and sqlite. It would separate out the behavior, but this would be a breaking change and thought would need to be made on the best approach.