Database Manager: using git to revert a change results in a corruption in the migration directory

Wappler Version : 5.3.3
Operating System : Windows 11
Server Model: node.js
Database Type: postgres
Hosting Type: local docker

Expected behavior

Git change is reverted and system functions properly

Actual behavior

Git change that included database changes results in the migration directory becoming corrupt.

image

How to reproduce

  1. Create database table with fields
  2. Save to git
  3. make another change to fields and save to git
  4. Revert the most recent change in git.

I’m guessing you reverted changes that were already applied to the database (which is done automatically upon creation of the change), meaning you didn’t reverse those migrations on Wappler’s UI before deleting them (reverting with Git)

Not sure if this qualifies as a bug if that’s the case. If that message didn’t appear, you would incorrectly create future migrations

There was no change to revert because of the error encountered in Database Manager: changing the name of a table breaks the database manager

Once again, the manager didn’t create a change file – rightly so – but it continues to show that changes need to be applied.
image

I had a previous git commit, so I tried to revert, but somehow the Database Manager has a different way of storing changes and now it’s looking for a migration file that doesn’t exist.

Interesting! So the “wappler_migrations” table should only be updated after the migration runs successfully (sentence for the team to fix)

You can access that table using a third-party DB viewer and erase the latest row (should be the failed change)

Actually reverting git actions and also database changes are tricky to do and have to be done in correct order to be successful.

The correct order when reverting in git is first to revert the database changes to the exact same point as in git and only after that then revert the git files.

So it is tricky and that is why we are planning to make it more integrated in the publishing process.

Now with publishing you can exactly stamp a specific version in git and we commit and apply db changes for it. For reverting exactly the same needs to be done but in reverse, first undo db changes and then revert git files. So we hope to integrate that in the ui soon.

What if Wappler does not have a database change to revert because it failed to make the change? See Database Manager: changing the name of a table breaks the database manager

Failed changes are no longer saved as files.

This was resolved by refreshing the table schema as discussed in Database Manager: changing the name of a table breaks the database manager.

1 Like

still we will be improving the git revert that is also do automatic database changes revert, so that everything stays in sync.

1 Like

Fixed in Wappler 5.4

This topic was automatically closed after 2 days. New replies are no longer allowed.