Skip to content

Commit

Permalink
feat: MySQL and MariaDB auto detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Feb 6, 2021
1 parent a0d8552 commit 02c03e3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/renderer/store/modules/workspaces.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export default {
SELECT_WORKSPACE (state, uid) {
state.selected_workspace = uid;
},
ADD_CONNECTED (state, { uid, client, dataTypes, indexTypes, structure, version }) {
ADD_CONNECTED (state, payload) {
const { uid, client, dataTypes, indexTypes, structure, version } = payload;

state.workspaces = state.workspaces.map(workspace => workspace.uid === uid
? {
...workspace,
Expand Down Expand Up @@ -251,8 +253,18 @@ export default {

if (status === 'error')
dispatch('notifications/addNotification', { status, message: version }, { root: true });
else {
//

const isMySQL = version.name.includes('MySQL');

if (isMySQL && connection.client !== 'mysql') {
const connProxy = Object.assign({}, connection);
connProxy.client = 'mysql';
dispatch('connections/editConnection', connProxy, { root: true });
}
else if (!isMySQL && connection.client === 'mysql') {
const connProxy = Object.assign({}, connection);
connProxy.client = 'maria';
dispatch('connections/editConnection', connProxy, { root: true });
}

commit('ADD_CONNECTED', {
Expand Down

0 comments on commit 02c03e3

Please sign in to comment.