Bug or technical issue? Sudden error in my database/tables

Correct - on Macbook 1 I had no tables and recreated a few to test. No errors. So I push to github and commit the changes.

MAcbook 2 - start a new project by cloning this github clone. Project opens, I right click under “Changes” the latest change and click on “Apply latest changes”. Error pops up saying migration failed because the table object “users” does not exist (which is what I created on Macbook 1). When I click refresh schema the tables all disappear.

So its almost like Wappler knows the tables should be there as they show them when the project loads, but as soon as you click Refresh schema they all disappear

Your migrations are already messed up (I guess). Easiest way to deal with this is to delete all migrations and re-create them again

Wappler is showing the tables as Macbook 1 saw (previously saved data in a separate file)

Macbook 2 sees an empty database because the first migration failed to run (looking for the users table)

There should exist a migration for creating the users table in first place, but it doesn’t, so I recommend you start from fresh

How do your changes look on MacBook one are they all green or is there some inactive orange ones listed.

Have you made any database backups while doing this?

Okay - big update. Thank you Apple! I deleted all the previous “Changes” and started from scratch. Now it is working. Something must have happened to one of my previous changes and mucked everything up.

@Sorry_Duh - you are on the money - from memory I had orange inactive ones. now its a green tick.

I will keep a look out for any corrupt “Changes” as these would cause the errors that probably alot of people are facing.

Few things from my experience what cause these are:

Deleting active migrations as you can then end up having a table etc that cant be created when the changes are next run.

If you have a migration active and backed up then you decide to roll back this change and delete the change the backup still looks for the change as it was active in the save so always make a new backup to override this.

Deleting migrations from inside the folder etc

There maybe more ways to have errors like these but this is a few I’ve noticed.

Thank you. If the box turns orange what does that mean? How do I fix that?

also-- I added a test table object but deleted it. Now when I fetch data it gives me the error saying column test does not exist. When I deleted the text object I committed the change.

Why does it not recognised that it’s deleted for good?

Green means the change is currently active so for example lets say I create a table, users and then save those edits this change should auto turn green on the development target.

If you was then to shutdown the docker container or look at a remote target to publish etc these changes would be orange meaning not active when you apply latest changes it activates all of these orange ones and creates the schema (activating them turning them green) why its a huge issue if a active change is deleted or corrupted as it cant carry on building the schema

Where do you get this error when running migrations on the second MacBook or viewing data in the manager etc?

On Macbook 1… just viewing/fetching data

Have you tried closing the users tab and then right click the users table to refresh it this could be what @Apple was mentioning with refreshing the schema

1 Like

aah man I can’t believe it was that simple haha. I am slowly but surely getting used to all the intricacies of Wappler… Thank you for that

1 Like

Just to clarify:

  • you are just using docker with local database in the development target?
  • have you committed to github also the .wappler folder (it is a hidden folder but it should be committed by default)? Specially .wappler/migrations which contains all the migration files.

When cloning the github on a different computer - you are actually creating a whole new local database, which is empty initially. So you just need to apply the pending database changes. This will make the database schema up to date, but you won’t have any data in it, as it is a brand new local database.

Well if you also create some database seeds for initial data you might apply them as well, so you have some base data.

Hi George,

Firstly, thank you for creating such an incredible platform! You guys are doing some amazing things.

Secondly, thanks for your response.

In answer to your questions

  1. Yes using docked with local db in development target
  2. I didn’t choose in particular the Wappler folder to commit to GitHub - I just did the usual commit changes and push to remote. I imagine this way automatically pushes the Wappler migration folder?

I now understand the importance of doing the migrations on the new device, but more importantly I need to keep an eye on the Changes to ensure they are green and not orange before I push to GitHub. If the latest change is Orange and I push to GitHub this is where the errors occur. I guess the tricky part of figuring out how to avoid corrupting the migration files or “Changes”.

FWIW, I had a similar error today. Sorry - didn’t take screen shot but basically when I tried to Apply Database Changes I got a similar error to Daves…

Resetting Changes History fixed the problem.