Skip to content

fix(model destroy): Return 0 when options is truncate. #12281

Merged
sushantdhiman merged 5 commits intosequelize:masterfrom
JuarezLustosa:feature/add_more_info_on_destroy_truncate
Jun 8, 2020
Merged

fix(model destroy): Return 0 when options is truncate. #12281
sushantdhiman merged 5 commits intosequelize:masterfrom
JuarezLustosa:feature/add_more_info_on_destroy_truncate

Conversation

@JuarezLustosa
Copy link
Contributor

@JuarezLustosa JuarezLustosa commented May 20, 2020

Pull Request check-list

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

This close #12164.

I was debugging and realize, the SSCE examples is passing truncate as an option. Therefore truncate on the database does not show affected rows so we can't return the value, thus I found the Postgres NaN in these cases.

  • I changed the doc adding info about it when use truncate will no show rows affected only on Sqlite do this.
  • Fixed Postgres rowCount when queryResult.rowCount isn't returning
  • Fixed MSsql when data is empty return 0 on isBulkDeleteQuery

@JuarezLustosa JuarezLustosa changed the title docs: Add info about options truncate on destroy fix(postgres): Return 0 when queryResult is empty May 20, 2020
@JuarezLustosa JuarezLustosa changed the title fix(postgres): Return 0 when queryResult is empty fix(model destroy): Return 0 when is empty a truncate May 20, 2020
@JuarezLustosa JuarezLustosa changed the title fix(model destroy): Return 0 when is empty a truncate fix(model destroy): Return 0 when options is truncate. May 20, 2020
@codecov
Copy link

codecov bot commented May 20, 2020

Codecov Report

Merging #12281 into master will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12281      +/-   ##
==========================================
+ Coverage   96.33%   96.40%   +0.06%     
==========================================
  Files          95       95              
  Lines        9118     9116       -2     
==========================================
+ Hits         8784     8788       +4     
+ Misses        334      328       -6     
Impacted Files Coverage Δ
lib/dialects/postgres/query.js 97.83% <ø> (ø)
lib/dialects/mssql/query.js 94.53% <100.00%> (-1.12%) ⬇️
lib/dialects/sqlite/query-generator.js 96.50% <0.00%> (-0.11%) ⬇️
lib/dialects/mysql/query-generator.js 97.56% <0.00%> (-0.06%) ⬇️
lib/dialects/postgres/query-interface.js 98.92% <0.00%> (-0.02%) ⬇️
lib/sequelize.js 95.81% <0.00%> (ø)
lib/transaction.js 100.00% <0.00%> (ø)
lib/associations/helpers.js 100.00% <0.00%> (ø)
lib/dialects/sqlite/query.js 98.18% <0.00%> (ø)
... and 15 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 c14972b...b54f139. Read the comment docs.

sushantdhiman and others added 2 commits June 8, 2020 10:06
Co-authored-by: Gabriel Sobrinho <gabriel.sobrinho@gmail.com>
@sushantdhiman sushantdhiman merged commit ed2d7a9 into sequelize:master Jun 8, 2020
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.

Model.destroy returns NaN as destroyed count

3 participants