Skip to content

Attributes Reorder#36

Open
ivan-ionin wants to merge 1 commit intofremail:masterfrom
ivan-ionin:master
Open

Attributes Reorder#36
ivan-ionin wants to merge 1 commit intofremail:masterfrom
ivan-ionin:master

Conversation

@ivan-ionin
Copy link

No description provided.

@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

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

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

❗ 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%) ⬇️

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

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

@fremail
Copy link
Owner

fremail commented Jan 30, 2023

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.

@ivan-ionin
Copy link
Author

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.

@fremail
Copy link
Owner

fremail commented Feb 1, 2023

@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?

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.

2 participants