Proper Way to Deal with Migration Failures and Rolling Back?

So I added an Enum and made a few minor changes and generated 3 SQL files. But when running a migration I got the error
node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^
PostgresError: type "market_segment_enum" does not exist

on one of my created enums. It seemed like something bugged out where it wasn't creating the enum in the proper order? Anyway, I had to delete my snapshot json, SQL, and _journal files back to last working migration (#5) vs #8 where i was.

If i didn't manually delete the migrations in the array in _jounral i would get throw new Error(No file ${migrationPath} found in ${migrationFolderTo} folder) error.

Not sure if there was a proper way of rolling back migrations but hopefully this manual approach helps anyone
Was this page helpful?