ER_NO_SUCH_TABLE when using Publish Manager and Issue trying to add it back as subtable

Trying to use Publish Manager for the first time to publish my local docker to Digital Ocean and everything seems to go smoothly until it starts applying the database changes. I get this error every time.

There was an error during publish alter table ‘user_role’ modify ‘role’ archer(255) - ER_NO_SUCH_TABLE: Table ‘databaseName.user_roles’ doesn’t exist.

Honestly I don’t recall creating this table and if I did, I removed it. I tried deleting the remote target and putting it back with no luck. I also manually imported the local database to the remote database so they would match but still getting the error. Perhaps something in the migration file?

Thanks in advance,
Twitch

Most likely the migration file is referring to a table that was deleted, and due to a Wappler bug somewhere in your lifeline changes weren’t totally synced to migrations

The real fix involves manually inspecting the migration files and erasing the offending line(s) (don’t delete the migration file itself)

Thanks for the reply, @Apple. Yes I just searched through the migration files and see files where I added the user_role table then deleted it. I quit Wappler and removed the files and reopened Wappler and tried again but then got a missing files error. I’ll investigate further and see where these references are.

No luck yet. I tried editing various things in the migration files with no success, so I decided to try and add it back as a subtable but now it won’t let me with another error that it already exists.
Here is a video of what is happening when I try to add it back.

Hopefully @Patrick has a quick solution. :wink:

And now it suddenly shows up as a regular table which is not what I want. :man_facepalming:
Screen Shot 2022-11-24 at 11.27.05 AM

I thought maybe I’d try a subtable with a completely new name but still no luck and a different error it appears. Anyway to “reset” the migrations?

Do you have a backup before you started messing around? :smiley:

Ummm…yes and no haha. I have since written a lot of code and db changes before getting the new errors. Would be a nightmare to figure out where to start unfortunately. I have faith it will get resolved. This community is great.
But yes, shame on me for not paying attention. Just trying to get a lot done while no one is bugging me during the holidays and using my surgery as an excuse as well. :wink:

Delete that migration that you just created that gave you an error, and then click refresh schema on Wappler’s database manager AND on each table individually. And then don’t create any more tables hoping to correct previous errors. And then tell me where it breaks once you run the migrations on the remote server (or you local if you start fresh)

Awesome I’ll try that. I deleted them before but didn’t refresh all tables etc.

Ok, can you not add a subtable to a table that was already existing that may have been made outside of Wappler? I just “reset” migrations the only way I could think of by deleting all the migration files and clearing the migration data table.
I quit and reopened Wappler and refreshed all the schema table by table and then tried to add a subtable to the Users table and got the usual errors.
I then tried creating a new table named “test” and then adding a subtable “testing” and when I applied the database changes, it worked.
Guess I’ll recreate the tables this way.
Thanks for your help, @Apple

After a little more testing, when I went to delete the top level “test” table and hit apply database changes, I got an error, but then I clicked delete on the subtable and this time when I clicked apply changes, it worked. :man_shrugging:
Perhaps you have to always choose to delete the subtable as well, I thought it would delete the subtables automatically.

FYI, I couldn’t add a subtable to a table I had created outside of Wappler until I changed the primary key data type from “int” to “int unsigned”. After I did that I let me add a subtable.