postgres - readonly connection

This commit is contained in:
Jan Prochazka
2022-03-17 13:27:33 +01:00
parent 8f1d76fd2a
commit 29591a613a
2 changed files with 13 additions and 7 deletions

View File

@@ -41,15 +41,16 @@ const postgresDriverBase = {
// showConnectionField: (field, values) =>
// ['server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase'].includes(field),
getQuerySplitterOptions: () => postgreSplitterOptions,
readOnlySessions: true,
databaseUrlPlaceholder: 'e.g. postgresql://user:password@localhost:5432/default_database',
showConnectionField: (field, values) => {
if (field == 'useDatabaseUrl') return true;
if (values.useDatabaseUrl) {
return ['databaseUrl'].includes(field);
return ['databaseUrl', 'isReadOnly'].includes(field);
}
return ['server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase'].includes(field);
return ['server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly'].includes(field);
},
beforeConnectionSave: connection => {
@@ -153,7 +154,7 @@ const redshiftDriver = {
title: 'Amazon Redshift',
defaultPort: 5439,
databaseUrlPlaceholder: 'e.g. redshift-cluster-1.xxxx.redshift.amazonaws.com:5439/dev',
showConnectionField: (field, values) => ['databaseUrl', 'user', 'password'].includes(field),
showConnectionField: (field, values) => ['databaseUrl', 'user', 'password', 'isReadOnly'].includes(field),
beforeConnectionSave: connection => {
const { databaseUrl } = connection;
if (databaseUrl) {