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

[Bug]Renaming fields in Collections #843

Open
Xhariel opened this issue Aug 22, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@Xhariel
Copy link

commented Aug 22, 2018

Changing the field name on an existing collection with data already stored does not rename the column but rather it stops indexing it and creates a new empty one.

The problems this proposes are the following:

  • When retrieving data via API, you get both the "old" field (Before rename) with its data and the new field (after rename) without any data (unless you input new data)
  • It does not show the "old" field on the UI so you can not delete them

@Xhariel Xhariel changed the title Renaming fields in Collections [Bug]Renaming fields in Collections Aug 22, 2018

@raffaelj

This comment has been minimized.

Copy link
Contributor

commented Aug 23, 2018

There is no elegant way to solve this behavior for now. Someone has to write it...
I opened the same issue before: #775

Don't change the name and use the label instead. Or you could export your data, manipulate it and import it afterwards as a workaround.

Here are some thoughts about cleaning the database: #821

@pauloamgomes

This comment has been minimized.

Copy link
Contributor

commented Dec 24, 2018

I faced the same issue and ended with a workaround on https://github.com/pauloamgomes/CockpitCMS-Helpers#better-handling-of-collection-and-singletons-structure-changes

the workaround works well and also provides a CLI command for updating all existing collection entries, however, is still an workaournd and think would be interesting to have that fixed in Cockpit himself. The challenging part is more on the collections (singletons are updated in a different way), the collection update() method performs an array merge between the new update data and the existing collection entry data and therefore the old values are not removed/updated. @aheinze could we have a force update method that is called from the collection entry edit and validates the collection data with the collection fields structure!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.