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

[question] clean database #821

Open
RoelantStegmann opened this issue Jul 20, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@RoelantStegmann
Copy link

commented Jul 20, 2018

How can we remove 'old' (removed) fields from the API requests and possibly even the database?

@DigitalGoldfish

This comment has been minimized.

Copy link

commented Jul 28, 2018

If you are willing to edit files manually you can do so by editing the files that contain the data directly:

  • For Regions the data is stored in PHP files in storage/regions - look for the array key "data"
  • For Collections the data is stored in an SQLite database in the file /storage/data/collections.sqlite

If you have more than a few records then you might have to write a script that does the cleaning for you - the schema is always stored in PHP files, should not be too hard to read that and match it to the data.

Occasionally I run into the same issue - but so far it never bothered me enough to write a script to clean it up - would be very welcome though.

@gryphonmyers

This comment has been minimized.

Copy link

commented Jul 30, 2018

Right now, Cockpit makes no attempt to clean up after itself. I am in the same boat as @DigitalGoldfish - it's annoying, but I haven't been bothered enough to try to write the functionality myself. It should really be a part of Cockpit, probably as an explicit "clean" operation at the collection / singleton level.

@raffaelj

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2018

Same here. Sometimes I thought about it and it's not easy to clean the right values. It is possible to store values without a defined field in the backend, like a unique slug or some plugin data and the cleaning script should know about it. So cleaning everything automatically could break setups with custom triggers on collection.save.before etc. Or you could erase "invisible" system options/fields by accident...

@RoelantStegmann

This comment has been minimized.

Copy link
Author

commented Oct 13, 2018

Agree that this shouldn't be automatic. Could imagine a button together with 'export', 'import' called 'clean' that handles it (maybe with an explicit warning). The expected behavior is that it will only leave the fields that exist in the current definition.

Bit busy with some other parts of my project but might come back to this one day :)

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.