OC tables editing

Hi, i would like to ask you all about editing the database tables of nextcloud running on dietpi. I have successfully edited, updated the oc_acccounts_data. However the data modified there, is not show up on GUI profile page. When i change something on profile page, it shows up in oc_accounts table. How do i edit it?
thank you

What are you trying to achieve? Editing the database directly is a bad idea in general, because there references might be missing, events are not triggered, etc.
Most things can be handled with a occ command

1 Like

Thank you. Yes i understand. However using brute force app, brought me to the case of updating that table. That is why i am interested in knowing a bit more detail. How i can use the occ command?

Your best chance is to tell us what you exactly try to do, most likely it is something someone else already has experience with :slight_smile:
For occ see Using the occ command — Nextcloud latest Administration Manual latest documentation

I just wanted to see if i update oc_accounts_data via mariaDB what happens with the GUI profile page. Unfortunately nothing. Then i have updated the GUI profile page and oc_accounts_data was not updated, but the oc_accounts yes. I tried to edit that table but i could not. I just want to understand how to work with these tables.

You’re not supposed to work with these tables at all. That’s it.

Editing database tables, especially when you don’t know how they’re used, will likely result in a broken Nextcloud instance at some point.

You can use the UI, the apps, occ or maybe even the different APIs offered by Nextcloud. But you shouldn’t ever fiddle with the database.

This is not some secret registry hack or cheatcode that can make Nextcloud do new things. It’s the data storage and once the data is inconsistent, it’s hard to fix it again.


I understand that, but i always want to know how everything works under the hood.

Nextcloud uses the Database as data storage. Which tables exist and how they’re structured is defined by Nextcloud and the apps you have installed.

It is possible to define the relation between tables within the database itself, but in the world of Nextcloud, this is usually done in the PHP code running on the server.

So when you do something in Nextcloud, that PHP code will fetch the required entries from the tables in the database, process them and show you the result.

That also means that without knowing the code, the database itself is not that useful since the meaning of that data and its relation to other data is defined in the code. The names of tables and columns only make sense within the application that uses them. So just looking at the names in the database may mislead you about what a table or column does.
It also means that editing the data in the database itself goes around the part that usually validates it and ensures the data is consistent and usable.

That is where the risk of editing the database lies: If you don’t know where this data is used and how the code expects it to look, you might change it in a way that is not expected. Or you might forget some other table that also needs to be updated accordingly.
Changes in the database should only be made by/with the help of the people who know how the code works

If you want to learn how Nextcloud works under the hood, take a look at the source code. Every class that extends OCP\AppFramework\Db\Entity is related to database entries from a specific table.