Merge pull request #1771 from grafana/gabor/postgres-id-fix

handle changed postgres-plugin-id
This commit is contained in:
Gábor Farkas
2024-01-09 15:15:38 +01:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -28,7 +28,8 @@ import {
import { Divider } from './Divider';
import { css } from '@emotion/css';
const SUPPORTED_SQL_DS = ['mysql', 'postgres', 'influxdb'];
// the postgres-plugin changed it's id, so we list both the old name and the new name
const SUPPORTED_SQL_DS = ['mysql', 'grafana-postgresql-datasource', 'postgres', 'influxdb'];
const authOptions: Array<SelectableValue<ZabbixAuthType>> = [
{ label: 'User and password', value: ZabbixAuthType.UserLogin },

View File

@@ -12,7 +12,8 @@ import dbConnector, {
const supportedDatabases = {
mysql: 'mysql',
postgres: 'postgres',
postgresOld: 'postgres',
postgresNew: 'grafana-postgresql-datasource',
};
export class SQLConnector extends DBConnector {
@@ -31,7 +32,10 @@ export class SQLConnector extends DBConnector {
}
loadSQLDialect() {
if (this.datasourceTypeId === supportedDatabases.postgres) {
if (
this.datasourceTypeId === supportedDatabases.postgresOld ||
this.datasourceTypeId === supportedDatabases.postgresNew
) {
this.sqlDialect = postgres;
} else {
this.sqlDialect = mysql;