Skip to content

Commit

Permalink
Return the FlywayResponse on error
Browse files Browse the repository at this point in the history
Confirm before cleaning
  • Loading branch information
gastaldi committed Jul 31, 2023
1 parent b530940 commit f308816
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
}

_clean(ds) {
this.jsonRpc.clean({ds: ds.name}).then(jsonRpcResponse => {
this._showResultNotification(jsonRpcResponse.result);
});
if (confirm('This will drop all objects (tables, views, procedures, triggers, ...) in the configured schema. Do you want to continue?')) {
this.jsonRpc.clean({ds: ds.name}).then(jsonRpcResponse => {
this._showResultNotification(jsonRpcResponse.result);
});
}
}

_migrate(ds) {
Expand Down Expand Up @@ -170,4 +172,4 @@ export class QwcFlywayDatasources extends QwcHotReloadElement {
}

}
customElements.define('qwc-flyway-datasources', QwcFlywayDatasources);
customElements.define('qwc-flyway-datasources', QwcFlywayDatasources);
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public FlywayActionResponse create(String ds) {
return new FlywayActionResponse("success",
"Initial migration created, Flyway will now manage this datasource");
} catch (Throwable t) {
new FlywayActionResponse("error", t.getMessage());
return new FlywayActionResponse("error", t.getMessage());
}
}
return errorNoScript(ds);
Expand Down Expand Up @@ -184,7 +184,7 @@ private Flyway getFlyway(String ds) {
return null;
}

static class FlywayDatasource {
public static class FlywayDatasource {
public String name;
public boolean hasMigrations;
public boolean createPossible;
Expand All @@ -199,7 +199,7 @@ public FlywayDatasource(String name, boolean hasMigrations, boolean createPossib
}
}

static class FlywayActionResponse {
public static class FlywayActionResponse {
public String type;
public String message;
public int number;
Expand Down

0 comments on commit f308816

Please sign in to comment.