Do not apply pending database changes on publish

I removed (i.e., undo this change) the two migrations related to creating a new table, and yet it's still trying to apply one, or both, of them, even though they do not appear in wappler_migrations table.

image

If I manually remove the two files from the file system .wappler\migrations\db, then the publish is successful.

It appears that the wappler_migrations table is not referenced during publication and applies all files in .wappler\migrations\db.

Yes you have to remove the unapplied migrations, otherwise those will be auto applied.

You can do that from the context menu.

So as a rule always make sure first that all changes are applied successfully before publishing.

If there are some error changes that aren’t applied just remove them first.

If I undo this change, I would expect it to not be applied during publish since it is no longer referenced in wappler_migration and has been removed from the local database schema.

It seems like a defect in how Wappler retains unapplied changes and yet still uses them as if they were applied, during publishing.

image

Well good point, but on the remote target where we publish, we have no idea which changes are applied and which not as just all migration files are uploaded and an apply all is done.

So maybe the best solution is to check before upload for unapplied changes and ask to either apply or delete them first, before publish can be done?

Since the remote db's wappler_migration table is updated on publish, why don't you look at it for the files to apply? That way we are not relying directly on the files in .wappler\migrations\db. It checks for the filename in wappler_migration and applies it if it matches a file in .wappler\migrations\db

1 Like

Remote is not yet updated. The current update status is only in the local database only, so we can look at that and if there are any unapplied files give a warning first.