Error when applying DB changes

I get an error when applying database changes in my postgres setup that I have created from scratch entirely in Wappler. Are there any suggestions how to work around this error? When checking the community posts here I see that one person had this problem while bringing in a db that was not created with Wappler, but mine is. I am new to wappler and this is the first time I am setting up a postgres db in Wappler. Applying changes works fine, unless i start using references. I tried to delete my entire project and setup a new one, but get the same error.
I strictly followed this guide: Wappler Documentation - Creating Database Relations with the Database Manager

Kindly suggest what am I doing wrong?
Without references in my db, I am forced to halt production for the time being.

See this screenshot for error and setup:

Here a second screenshot of my setup using Docker:

After investigating a few more hours, I found out that only in the second project created I cannot apply reference items in the db. When I delete all projects in Wappler and in Docker and then start from scratch, I can create references in the first project created. However, if I create a second project, I get errors applying db changes that include references (all other db changes apply fine).
I made a small video about the issue:

@Hyperbytes @franse do you have any idea what my problem could be?
I am sure, I am just doing a small stupid mistake, but I am unable to figure it out by myself. I also mailed support, but didn't get an answer either. Maybe it's summer holidays for everybody? I hope i get some help from the community. I really would like to use Wappler for our projects.

Sorry my friend, I'm not familiarized with docker :frowning_face:

Just a tip: share some screenshot and paste some error log here so everybody can see it and not forced to open the drive video..

Maybe someone can help you and if it's using a mobile phone, well, maybe it's not easy to look a full screen video..

One observation I can make from what I see on the video is the error that you mention on 02:33

The port on the direct database connection (green: 9906) it's not the same than the project (red: 9909)

Try to change the settings by clicking on the "Database name" (1), and click on Database Connection (2)
image

In my case my db is test_remote in your case is db

Then you can see all the info about it

1 Like

Likewise, i gave up on docker a long time ago as in my opinion it causes more wappler issues than it solves.

2 Likes

Having said that, i gree with franse, the docker db port looks wrong,normally 9906

Amazing! Thank you so much for answering. Interesting to learn that Docker is not recommended to use with Wappler. Alright, I have taken your advice and installed PostgreSQL 15.7 on my Win11 system. In pgAdmin 4 i created a new database called "ndty".
It looks like this:


(I seem to be unable to share more than one image here, hence I make a new post reply below...)

In Wappler I created a new database connection that looks like this:

Unfortunately, when i run this I get an error that I do not understand:

Any ideas how I can solve this?
Or even better: Do you have any step-by-step instructions for how to create a local postgres db and then connect it to Wappler (incl generating the db)? I couldn't find any on youtube nor in the help section. Maybe i just looked in the wrong places?
Thanks!

The connection credentials seems fine, as I can connect to the pgAdmin generated db through DBeaver just fine. Not sure if that helps excluding some questions.

No, that is not the case, it is popular with a lot of users and should be perfectly usable with Wappler, just not preferred by me and franse.
It's a personal choice

Docker and Wappler work great together. Yes it does take a little tweaking here and there but then so do many environments (especially for customised deployments). Your system configuration plays a big part with Docker but once you have that sorted it is all relatively straight forward. Scalability and security are fantastic. Docker Scout is a great tool and entirely free and the Docker documentation covers everything with regards to tightening up your containers. Then on top you can load balance across multiple nodes using Docker Swarm. Indeed Wappler does not offer full control over Docker but then nor does it offer full control over PHP, ASP, or Node. We went from operating our own dedicated servers which we had provisioned for nearly twenty years over to Docker and have not looked back. Suppose it is all down to the User and what they want and feel comfortable with (their use case, and stack preference)... And that is the fantastic ability Wappler offers, choice.

Most of the time Docker works great, helping to keep all environments consistent. It also makes it easy to migrate from one host to another without having to worry about differences between hardware, OS, and other variables in infrastructure. There is a small learning curve, but it's well worth the time.

I would definitely prefer to work with docker than to setup my own postgres db. I just have no idea why I get the error that I describe in the beginning. I setup a db for my first Wappler project (using Docker) and everything works fine. Then, setting up a second project (also using Docker) the db sety up fine, but I get errors whenever I try to setup references, and references only (See the full description of the problem in above video).

I hired a freelancer to solve the problem for me and he was able to work it out, but only by managing the db in another software. This caused errors in Wapplers "Changes" log, because the log files Wappler is creating were missing when maintaining the db through third party software.

I wonder how you all can work with Wappler so easily, if I struggle to even fail to setup a basic db, which for me is the foundation for any app. I didn't even move to FE yet and keep on working on it for two weeks, now.
Sorry, for my frustration. I really would love to work with Wappler, and I understand that I have to bite through the hardship. But I really need help and don't know where to get it from.

Please note that Wappler’s db changes tracking rely strictly on Wappler being fully in control and aware of its changes. If changes are made in the mean time with other db software or directly in the database, a mismatch can occur that Wappler is not aware of and then wrong new changes will be produced.

Your project is screwed up, here are the steps to fix:

  1. Delete all database Changes (a.k.a. migrations)
  2. Destroy project resources (power button in Wappler; assuming you're using Docker)
  3. Click Deploy button
  4. Re-create database tables from scratch and DO NOT change the primary column (e.g.: do not rename "id" to "user_id"; do not rename "id" to "role_id"; such renames are rarely done, it's better you leave that habit early on)
  5. Only create references AFTER the columns are created and the Changes have been successfully run

It's better to have multiple small Changes than one big, because of possible Wappler bugs like you've run into...

Am I correct in thinking that, from Wappler's point of view, there is no problem or disadvantage in managing the database with dedicated DM management software - eg Navicat or DBeaver - rather than Wappler's Database Manager?

Wappler needs to track the database schema at all times,a function normally managed automatically by the DB manager.

You can use external DB managers but it is ESSENTIAL thst you refresh any schemas via the DB manager if making changes so Wappler understands any changes or errors will result.

1 Like