Well usually such things are done with database transactions.
But unfortunately transactions are not supported in database mutation statements. So you can’t undo the already executed statements.
Maybe we can generate more enhanced knex migration script that has an error checking around each statement to execute but then it has to keep track of the ones executed above and undo them in case of error…
I haven’t tried using the terminal. I also doubt that will work as expected because imagine there are 2 linesi. the ‘up’ statement: and line 2 fails…
Then the ‘down’ statement tries to also undo whatever line 2 was and fail.
@George Hmm what can also help is better Knex generation in general, I will report the next errors I get that are due to the the generation logic