fix to show error notification when run sql fails in cli mode (close #2438) (#2446)

This commit is contained in:
Aravind Shankar 2019-06-28 18:04:30 +05:30 committed by Rikin Kachhia
parent f86fcde723
commit 35230cb091
2 changed files with 7 additions and 2 deletions

View File

@ -128,9 +128,14 @@ const executeSQL = (isMigration, migrationName) => (dispatch, getState) => {
}
response.json().then(
errorMsg => {
const title = 'SQL Execution Failed';
dispatch({ type: UPDATE_MIGRATION_STATUS_ERROR, data: errorMsg });
dispatch({ type: REQUEST_ERROR, data: errorMsg });
dispatch(handleMigrationErrors('SQL Execution Failed', errorMsg));
if (isMigration) {
dispatch(handleMigrationErrors(title, errorMsg));
} else {
dispatch(showErrorNotification(title, errorMsg.code, errorMsg));
}
},
() => {
dispatch(

View File

@ -80,7 +80,7 @@ const RawSQL = ({
const isMigration = checkboxElem ? checkboxElem.checked : false;
const textboxElem = document.getElementById('migration-name');
let migrationName = textboxElem ? textboxElem.value : '';
if (migrationName.length === 0) {
if (isMigration && migrationName.length === 0) {
migrationName = 'run_sql_migration';
}
if (!isMigration && globals.consoleMode === 'cli') {