DB Schema corruption and breaking server actions

One of the db.json files keeps getting corrupted causing different unwanted behaviours.
The issue of today is that a server action on production seems broken.
Upon investigating I open the server action and check the query, I get the following error:

To fix this error (because it definitely exists). I have to right click on that specific table and refresh the schema:

IT does NOT work to refresh with any of these 3 buttons image
It HAS to be the specific table.

Now this is probably caused with git merges as these issues came after we started working with other wappler freelancers. Someone on another branch has a different db.json file as their database looks different (they’re adding columns) which the other branch doesn’t have. So then after migrating, the db.json should be regenerated fully and completely (I assume!)

As far as I understand, the db.json should refresh automatically and completely (with the big button on the top or by at least rightclicking db) to prevent this.
This is the file that is the issue:

But please help find the core issue and fix.

@sid Do you and your team perhaps have a solution for this issue?

This is a nightmare, we have this kind of problems here as well…
I fix all the issues manually… Looking forward to check how @sid manages it and what are the best practices.

1 Like

The solution is to find the table and refresh schema… as you have noted. Its extremely annoying!

The unstaged DB schema file is something that we commit very rarely. Since it causes more problems when working with branches, than doing a manual refresh.

I had created a FR for going around this issue some time ago, but no attention from Wappler team yet. Refresh Schema Option In Query Builder Warning Popup

Yeah, unfortunately, there have been many reports about the Refresh not working as users would expect. Maybe Wappler should remove all Refresh icons/menu items except on the individual tables?


Are you using Database Manager and keeping the changes for database migrations? If you do then on a checkout you will be prompted to apply database changes first so this will bring the database structure to the desired one automatically.

Yes using the db manager and keeping changes.
However, I’m using both an external git client and wappler’s git client.

I now first checkout using external git client (gitkraken) because with Wappler’s it’s very hard or will get nondescriptive errors when there’s conflicts and such that it can’t fix.

Then I switch back, then checkout once again so I can use wappler’s built in tool to revert / apply changes when necessary.

So for example:

  1. Main → feature-branch → main (using gitkraken)
  2. Main → feature-branch (using wappler’s git tool, and it’ll ask to apply/revert db changes)

THis has been working pretty well, yet we lost another ‘where’ condition yesterday in a query for some reason. Which is probably due to the column not being in the db.json which then resets the where condition. But you can confirm if that is possible…

The automatic database migrations apply on git checkout or branch switch only work when this is done by the Wappler Git Manager.

So if you want to use those you should stick to the Wappler Git Manager otherwise you will have indeed more database corruptions due to not executed git changes.

Specially when reverting with git it is very important to execute the changes first as after that the migrations files will be gone when reverting.

Why not detect external branch change automatically through Wappler? Something like monitoring Git files to know if something changed

Fixed in Wappler 5.8.2

This topic was automatically closed after 25 hours. New replies are no longer allowed.