Database Structure not copied to fresh remote Docker target on deployment

Wappler Version : 3.0.0 Beta 5
Operating System : W10Pro-latest

Expected behavior

What do you think should happen?
The project’s database structure and data were saved as a backup while on the local (Docker) target.
When deploying a new (remote Docker) target that database structure (of the default db database) should be copied to the new target on deployment, according to @George. This is my db structure on the local Docker target:
image

Actual behavior

What actually happens?
The database structure is not copied and demo database structure from Wappler is created on the Docker remote target:
image

How to reproduce

  1. Setup a local docker target with default db Database (PostgreSQL)
  2. Create a database structure, tables and fields
  3. Save Database Data and Structure:
    image
  4. Setup a remote Docker target, also with PostgreSQL database:
    image
  5. Deploy the project on the remote target
  6. Check the default db database structure in the database manager and see the expected database structure is not there.

While being advised before to try the beta version as a solution for this issue, I also tried on stable version before and had the same problems there.
I also mentioned this problem to @George and @Teodor in a private conversation before, there’s even a video where I reproduce the issue in this post.

EDIT: I tried the same process on a local docker target, also doesn’t copy the database structure and data.

Please let me know if you need more details. Thanks.

1 Like

To anyone who’s experiencing these problems, here’s a solution/workaround for it:

  1. In Wappler, open your app on the origin target you want to copy the database data and structure from (in my case the local docker target).
  2. Click the Save Database Data and Structure button.
  3. Go to the specific target’s database initialization folder: .wappler/targets/your_origin_target/db_init
  4. Copy the db_save.sql file to your new target’s database initialization folder: .wappler/targets/your_new_target/db_init (in my case the remote docker target)
  5. Deploy your app on the new target and find your database structure and data there :raised_hands:
7 Likes

Hi, I was looking solution to sync development and production Dbs…
This procedure has been automated in the meantime or not?

I’m having the same problem and @Emiel solution didn’t work for me…My postgres database schema is not being replicated to production env.

Sorry for the late reply on this @otavionestares, but did you Shutdown and Clear all services before deploying to the production target?
image

1 Like

Hey @Emiel! Thanks for your reply! George helped me and it was the postgres log option on enviroment config, it should be set to “off” for production env!
Maybe this is a necessary config to postgres DB + docker

Actually this is an old topic. That describes more a way to dump your database.

The easies way deploy the database changes on your remote you just need to select the remote target and choose, apply latest changes.

See for more general info:

1 Like

Thanks George, but just to be sure:
This method still works, right? Or is that bad practice currently?

that is only meant for initial database creation and not recommended if you have created the database structure with the database manager from the start. You can then just use the database manager to apply your changes and don’t have to deal with sql code any more.

This enabled me to copy my database structure and content, so I can work on the same project both on my laptop as on my desktop. Awesome! :grin: :tada:

1 Like