How to run database migration through CLI?


I’m setting up my NodeJS production deployment using Caprover.

Something I haven’t figured out, what’s the command you run to deploy migrations? So I can automatically run that command at each deployment.

Otherwise, I may deploy and leave the app hanging due to missing tables :sweat_smile:

On Wappler’s Web Server terminal:

We don’t have CLI for applying the database changes. You just have to use the database manager.

When you switch to your production target, you can see the pending changes there and apply them first before clicking on deploy.

We do plan to integrate that in a single deploy action in the future.

@george a Wappler CLI wouldn’t be a bad idea at all.

I know you are probably still on the whiteboard for targets, deployments as per the last two oldish RFC topics your created.

If you could make the UI interact with a Wappler CLI for all those operations instead of abstracting the actions behind the UI you could kill two birds with one stone. Simplicity for regular users that rely on the UI and a CLI for those of us that like to CI/CD.

It wouldn’t add too much overhead either as the bulk of logic would be contained in the CLI and the UI would just need to call it like it does for brew or scoop.

Will keep that in mind when restructuring. We need to more and more centralize Wappler UI actions in global API libraries. Currently those are built-in per UI component.

So when we have such global Wappler API libraries, we can reuse them more easily and indeed maybe build a CLI someday.

1 Like

Can I still do this if I don't use Docker-Machine deployment? How do I tell Wappler to connect to my remote database?

Edit: Solved by creating a Production target (own server [instead of Docker]), and then clicking Direct Database Connection on Database Manager

1 Like