diff --git a/src/common/customizations/defaults.js b/src/common/customizations/defaults.js index 9a53c36a..b2e6d2e3 100644 --- a/src/common/customizations/defaults.js +++ b/src/common/customizations/defaults.js @@ -1,5 +1,10 @@ module.exports = { + // Defaults + defaultPort: null, + defaultUser: null, + defaultDatabase: null, // Core + database: false, collations: false, engines: false, // Tools @@ -7,7 +12,7 @@ module.exports = { usersManagement: false, variables: false, // Structure - databases: true, + schemas: false, tables: false, views: false, triggers: false, diff --git a/src/common/customizations/index.js b/src/common/customizations/index.js new file mode 100644 index 00000000..304889a4 --- /dev/null +++ b/src/common/customizations/index.js @@ -0,0 +1,5 @@ +module.exports = { + maria: require('./mysql'), + mysql: require('./mysql'), + pg: require('./postgresql') +}; diff --git a/src/common/customizations/mysql.js b/src/common/customizations/mysql.js index d01906db..254c4634 100644 --- a/src/common/customizations/mysql.js +++ b/src/common/customizations/mysql.js @@ -2,6 +2,10 @@ const defaults = require('./defaults'); module.exports = { ...defaults, + // Defaults + defaultPort: 3306, + defaultUser: 'root', + defaultDatabase: null, // Core collations: true, engines: true, diff --git a/src/common/customizations/postgresql.js b/src/common/customizations/postgresql.js index 79ac60d1..3b8aefc5 100644 --- a/src/common/customizations/postgresql.js +++ b/src/common/customizations/postgresql.js @@ -2,17 +2,20 @@ const defaults = require('./defaults'); module.exports = { ...defaults, + // Defaults + defaultPort: 5432, + defaultUser: 'postgres', + defaultDatabase: 'postgres', // Core - collations: false, - engines: false, + database: true, // Tools processesList: true, // Structure tables: true, - views: true, - triggers: true, - routines: true, - functions: true, + views: false, + triggers: false, + routines: false, + functions: false, schedulers: false, // Settings databaseEdit: false, diff --git a/src/main/ipc-handlers/connection.js b/src/main/ipc-handlers/connection.js index 77a6de2a..62276b55 100644 --- a/src/main/ipc-handlers/connection.js +++ b/src/main/ipc-handlers/connection.js @@ -11,6 +11,9 @@ export default connections => { password: conn.password }; + if (conn.database) + params.database = conn.database; + if (conn.ssl) { params.ssl = { key: conn.key ? fs.readFileSync(conn.key) : null, @@ -50,6 +53,9 @@ export default connections => { password: conn.password }; + if (conn.database) + params.database = conn.database; + if (conn.ssl) { params.ssl = { key: conn.key ? fs.readFileSync(conn.key) : null, diff --git a/src/main/libs/clients/PostgreSQLClient.js b/src/main/libs/clients/PostgreSQLClient.js index 16092a42..59de7acb 100644 --- a/src/main/libs/clients/PostgreSQLClient.js +++ b/src/main/libs/clients/PostgreSQLClient.js @@ -75,7 +75,8 @@ export class PostgreSQLClient extends AntaresCore { async connect () { if (!this._poolSize) { const client = new Client(this._params); - this._connection = client.connect(); + await client.connect(); + this._connection = client; } else { const pool = new Pool({ ...this._params, max: this._poolSize }); diff --git a/src/renderer/components/ModalEditConnection.vue b/src/renderer/components/ModalEditConnection.vue index f431cf48..6a2a5f5e 100644 --- a/src/renderer/components/ModalEditConnection.vue +++ b/src/renderer/components/ModalEditConnection.vue @@ -63,11 +63,11 @@ PostgreSQL + Microsoft SQL + + --> @@ -97,6 +97,18 @@ > +
+
+ +
+
+ +
+
@@ -247,6 +259,7 @@