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

Merge 1.x changes #249

Merged
merged 9 commits into from
Dec 28, 2021
Merged

Merge 1.x changes #249

merged 9 commits into from
Dec 28, 2021

Conversation

cyjake
Copy link
Owner

@cyjake cyjake commented Dec 28, 2021

att

cyjake and others added 9 commits December 28, 2021 10:59
* fix: information_schema.columns.datetime_precision

`new Model(values)` should have values rounded according to precision

* fix: date rounding
#247)

```js
const result = await Post.include('comments').order('comments.id', 'desc').order('posts.id', 'desc').limit(1);
```

This query might retrives wrong result because the post with latest comments isn't necessarily the latest one, such as:

| post_id | comment_id |
|---------|------------|
| 1       | 3          |
| 2       | 2          |
| 3       | 1          |

Previous implementation will yield SQL like:

```sql
SELECT posts.*, comments.*
  FROM (SELECT * FROM posts ORDER BY id DESC)
    AS posts
  LEFT JOIN comments ON posts.id = comments.post_id
 ORDER BY comments.id desc
```

which retrives `Post<#id 3>`, but `Post<#id 1>` is the one with the latest comment.
@cyjake cyjake changed the title chore: Merge 1.x changes Merge 1.x changes Dec 28, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2021

Codecov Report

Merging #249 (a5f25e0) into master (13f1bd3) will increase coverage by 0.01%.
The diff coverage is 98.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #249      +/-   ##
==========================================
+ Coverage   97.30%   97.32%   +0.01%     
==========================================
  Files          42       43       +1     
  Lines        3114     3135      +21     
==========================================
+ Hits         3030     3051      +21     
  Misses         84       84              
Impacted Files Coverage Δ
src/drivers/mysql/schema.js 96.96% <ø> (ø)
src/drivers/postgres/attribute.js 100.00% <ø> (ø)
src/data_types.js 98.73% <95.00%> (-0.61%) ⬇️
src/bone.js 97.29% <100.00%> (+0.03%) ⬆️
src/drivers/abstract/spellbook.js 96.61% <100.00%> (+0.02%) ⬆️
src/drivers/postgres/schema.js 100.00% <100.00%> (ø)
src/drivers/sqlite/data_types.js 100.00% <100.00%> (ø)
src/drivers/sqlite/schema.js 98.98% <100.00%> (+1.07%) ⬆️
src/query_object.js 98.50% <100.00%> (+0.02%) ⬆️
src/raw.js 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13f1bd3...a5f25e0. Read the comment docs.

@cyjake cyjake merged commit 5eb1672 into master Dec 28, 2021
@cyjake cyjake deleted the merge-1.x-changes branch December 28, 2021 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants