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

Feat: Stable Field/Attribute Identifier which doesn't change on field rename #3196

Closed
9 of 10 tasks
iJungleboy opened this issue Oct 24, 2023 · 1 comment
Closed
9 of 10 tasks
Assignees

Comments

@iJungleboy
Copy link
Contributor

iJungleboy commented Oct 24, 2023

I'm submitting a

[x] feature request

...about

[x] Content Types or data management

Current Behavior / Challenges

Entities have Attributes such as FirstName or Tags. These are identified by their string name. When stored in the DB the data integrity is ensured through IDs. When exported to JSON the name is used as a reference.

This works for most scenarios, but lacks in the following cases:

  1. If a entity was edited, the history JSON uses the name. Now if the field is renamed, it's not possible to restore the value as the names have changed.
  2. If entities are stored in the file system as JSON, and the underlying (json based) type would rename the field, the reference would also fail. This is a fairly advanced, untypical scenario, but it restricts us from renaming fields which change their purpose over time.
  3. A future feature Content Type Inheritance (Like Class Inheritance) #3192 would require very stable references to other field definitions, where renames could cause a lot of trouble.

Expected Behavior

We should define a stable field identifier such as a GUID which doesn't change on rename.
This could then be used for such "long term references" instead of the string-name, which may change.

Steps to implement

  • Extend the in-memory attribute definitions to have a Guid as well as further SysSettings similar to Apps @iJungleboy
  • Ensure that import/export of content-types and attribute definitions to JSON preserve this @iJungleboy
  • Extend DB table ToSIC_EAV_Attributes with Guid nullable and SysSettings nvarchar(max), nullable @tvatavuk
  • Extend DB table ToSIC_EAV_AttributeSets with SysSettings nvarchar(max), nullable for future features @tvatavuk
  • Extend Entity Framework Model with these new fields @tvatavuk
  • Improve data loading from SQL to load this information into memory (but not do anything with it yet) @tvatavuk
  • Include AttributeMap on IEntity JSON for all attributes with GUIDs @iJungleboy
  • Implement restore-from-history/import despite renamed fields @tvatavuk
  • Continue on shared-field config scenario @iJungleboy
  • plan next steps @iJungleboy

Your environment

  • 2sxc version(s): 16.07
@tvatavuk
Copy link
Contributor

2sic/eav-server@b68a74

tvatavuk added a commit to 2sic/eav-server that referenced this issue Oct 24, 2023
iJungleboy added a commit to 2sic/eav-server that referenced this issue Oct 24, 2023
iJungleboy added a commit to 2sic/eav-server that referenced this issue Oct 25, 2023
iJungleboy added a commit to 2sic/eav-server that referenced this issue Oct 26, 2023
iJungleboy added a commit to 2sic/eav-server that referenced this issue Oct 26, 2023
iJungleboy added a commit to 2sic/eav-server that referenced this issue Oct 26, 2023
iJungleboy added a commit to 2sic/eav-server that referenced this issue Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: v17.02.00
Development

No branches or pull requests

2 participants