Database - how to set the project settings remote database as the default to be used with the remote database

Been using node an docker for a while now and after many years using Wappler I still cannot get my head around using local and remote databases.

I setup a php project with local docker container for web and database which works as it should.

Then I setup a remote target with it’s sftp and database settings in project settings.

When publishing the site to remote target I see the database being used is the local docker db and obviously nothing works

In database connections tab I setup another db connection to the remote server, just in case I could find a way to switch to it, but no idea how to make sure the right connection is sent to my remote server.

Maybe I am thinking is a too complicated way (Which I doubt :crazy_face:) but there must be a very logical basic way to make sure a connection is associated with a target?

Anyone cracked the code?

I got totally lost and confused with all this different connection settings. For me, it worked this way:

  • Create the different environments / targets, but did not enter database details in the project settings (not sure what their are for)
  • Select your environment (bottom left), go to globals / database connection / your db connection (only one is required!) and open the connection options. Enter the database settings for the selected environment.
  • Close(!) that db connection tab (Important, otherwise the settings are not refreshed after the following switch!)
  • Switch your target to production (or how your publishing target is called)
  • Open your DB connection and enter for production. Again, save and close(!) the tab.
  • Now every publishing target has its own settings.

I had similar challenges, you find a bit more info here:

1 Like

I think this issue is hanging around after all this time because the CLOSE THE TAB action is the ONLY WAY Wappler “works” but was not specified in tutorials as a necessary requirement in the whole process of defining different targets.

  • Close(!) that db connection tab (Important, otherwise the settings are not refreshed after the following switch!)
  • Switch your target to production (or how your publishing target is called)
  • Open your DB connection and enter for production. Again, save and close(!) the tab.
1 Like