sequelize-nested-set icon indicating copy to clipboard operation
sequelize-nested-set copied to clipboard

Attributes Reorder

Open ivan-ionin opened this issue 2 years ago • 4 comments

ivan-ionin avatar Jan 30 '23 13:01 ivan-ionin

Codecov Report

Base: 77.37% // Head: 76.49% // Decreases project coverage by -0.88% :warning:

Coverage data is based on head (a215cda) compared to base (a25d463). Patch coverage: 25.00% of modified lines in pull request are covered.

:exclamation: Current head a215cda differs from pull request most recent head 84c840f. Consider uploading reports for the commit 84c840f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #36      +/-   ##
==========================================
- Coverage   77.37%   76.49%   -0.88%     
==========================================
  Files           2        2              
  Lines         495      502       +7     
==========================================
+ Hits          383      384       +1     
- Misses        112      118       +6     
Impacted Files Coverage Δ
index.js 76.37% <25.00%> (-0.90%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jan 30 '23 13:01 codecov[bot]

Hi, @ivan-ionin. Thank you for your PR!

Could you clarify the purpose of your changes please? To be honest, I didn't work with Sequelize the last few years, but AFAIK the attribute order doesn't matter.

fremail avatar Jan 30 '23 21:01 fremail

When i create table i got attributes order like this:

-- left_key -- right_key -- level -- root -- id (primary) -- ...anotherMyCustomFields

I want to control it:

-- id (primary) -- left_key -- right_key -- level -- root -- ...anotherMyCustomFields

... because in my company very hard sql convention.

Sorry, i forgot add information to README.md in my pool request.

ivan-ionin avatar Feb 01 '23 05:02 ivan-ionin

@ivan-ionin that makes sense. Thanks for explanation.

nsAfterField solves your particular issue, but doesn't provide full control over field order. How about nsFieldOrder array containing all fields in the desired order?

Example: nsFieldOrder = ['id', 'root', 'tag_name', 'left_key', 'level', 'right_key'];

That will allow you to reorder even internal nested set fields. And implementation of that option isn't hard -- a simple loop over that array.

It would be great to use nsOptions as other code does. And as you mentioned, it needs to add info about the new field into README.md.

Could you kindly do the updates?

fremail avatar Feb 01 '23 21:02 fremail