migrations icon indicating copy to clipboard operation
migrations copied to clipboard

How to skip failed lines in migration file

Open chiruyarabolu opened this issue 3 years ago • 1 comments

Hello Team,

I have a script which has multiple lines of db execution lines in which if any of the lines are failed while executing it is not picking up the next lines. Any way to skip the failed lines and execute the next lines?

Ex : INSERT INTO table1 (LOCALE, TRANSLATIONGUID, TRANSLATIONKEY, TRANSLATIONVALUE) VALUES ('en-US', 'translationguid', 'translationkey.', 'Value');

INSERT INTO TABLE1 (LOCALE, TRANSLATIONGUID, TRANSLATIONKEY, TRANSLATIONVALUE) VALUES ('en-US', 'translationguid', 'translationkey', 'value');

The execution of 1st line got failed due to the below error Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (MYBATIS1.UX_1_ASTRANSLATION) violated

Any way to skip this line of execution and execute the following lines?

chiruyarabolu avatar Jul 28 '22 10:07 chiruyarabolu

Hello @chiruyarabolu ,

You have to figure out a way to avoid the unique constraint violation. For Oracle, you should be able to use MERGE statement.

harawata avatar Jul 28 '22 17:07 harawata