Rollback services after published in swarm

Hi There, I build a little project in nodejs, so I decided integrate it to docker swarm using the application, an image postgres and mongo. Well, My doubt here is, if I generate a build of my application and and publish it in docker hub, when someone run my image inside there I have a migration to run before start the application, so far so good. Now let say that I have a new image with a new feature where is needed run the migration, so I will update the service in swarm with the new image version and run the migration, in other word the database has been updated. Now lets suppose that I need do a rollback that latest version, here the problem: “I can rollback the last version of my image, but how about the migration that already have ran previously, How can I undo?” Sorry a can’t be clear about my problem, I’m newer in docker swarm.
If someone can help me I appreciate it.