mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 07:36:00 +00:00
non default schema name in tab title
This commit is contained in:
@@ -16,6 +16,7 @@ const dialect = {
|
|||||||
isSparse: false,
|
isSparse: false,
|
||||||
isPersisted: false,
|
isPersisted: false,
|
||||||
},
|
},
|
||||||
|
defaultSchemaName: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const driverBase = {
|
export const driverBase = {
|
||||||
|
|||||||
1
packages/types/dialect.d.ts
vendored
1
packages/types/dialect.d.ts
vendored
@@ -9,6 +9,7 @@ export interface SqlDialect {
|
|||||||
fallbackDataType?: string;
|
fallbackDataType?: string;
|
||||||
explicitDropConstraint?: boolean;
|
explicitDropConstraint?: boolean;
|
||||||
anonymousPrimaryKey?: boolean;
|
anonymousPrimaryKey?: boolean;
|
||||||
|
defaultSchemaName?: string;
|
||||||
enableConstraintsPerTable?: boolean;
|
enableConstraintsPerTable?: boolean;
|
||||||
|
|
||||||
dropColumnDependencies?: string[];
|
dropColumnDependencies?: string[];
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
schemaName,
|
schemaName,
|
||||||
...(columns?.map(({ columnName }) => ({ childName: columnName })) || [])
|
...(columns?.map(({ columnName }) => ({ childName: columnName })) || [])
|
||||||
);
|
);
|
||||||
export const createTitle = ({ pureName }) => pureName;
|
export const createTitle = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||||
|
|
||||||
export const databaseObjectIcons = {
|
export const databaseObjectIcons = {
|
||||||
tables: 'img table',
|
tables: 'img table',
|
||||||
@@ -586,6 +586,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getObjectTitle(connection, schemaName, pureName) {
|
||||||
|
const driver = findEngineDriver(connection, getExtensions());
|
||||||
|
|
||||||
|
const defaultSchema = driver?.dialect?.defaultSchemaName;
|
||||||
|
if (schemaName && defaultSchema && schemaName != defaultSchema) {
|
||||||
|
return `${schemaName}.${pureName}`;
|
||||||
|
}
|
||||||
|
return pureName;
|
||||||
|
}
|
||||||
|
|
||||||
export async function openDatabaseObjectDetail(
|
export async function openDatabaseObjectDetail(
|
||||||
tabComponent,
|
tabComponent,
|
||||||
scriptTemplate,
|
scriptTemplate,
|
||||||
@@ -603,7 +613,7 @@
|
|||||||
|
|
||||||
openNewTab(
|
openNewTab(
|
||||||
{
|
{
|
||||||
title: scriptTemplate ? 'Query #' : pureName,
|
title: scriptTemplate ? 'Query #' : getObjectTitle(connection, schemaName, pureName),
|
||||||
tooltip,
|
tooltip,
|
||||||
icon: icon || (scriptTemplate ? 'img sql-file' : databaseObjectIcons[objectTypeField]),
|
icon: icon || (scriptTemplate ? 'img sql-file' : databaseObjectIcons[objectTypeField]),
|
||||||
tabComponent: scriptTemplate ? 'QueryTab' : tabComponent,
|
tabComponent: scriptTemplate ? 'QueryTab' : tabComponent,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const dialect = {
|
|||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
offsetFetchRangeSyntax: true,
|
offsetFetchRangeSyntax: true,
|
||||||
rowNumberOverPaging: true,
|
rowNumberOverPaging: true,
|
||||||
|
defaultSchemaName: 'dbo',
|
||||||
stringEscapeChar: "'",
|
stringEscapeChar: "'",
|
||||||
fallbackDataType: 'nvarchar(max)',
|
fallbackDataType: 'nvarchar(max)',
|
||||||
explicitDropConstraint: false,
|
explicitDropConstraint: false,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const spatialTypes = ['GEOGRAPHY'];
|
|||||||
const dialect = {
|
const dialect = {
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
ilike: true,
|
ilike: true,
|
||||||
|
defaultSchemaName: 'public',
|
||||||
// stringEscapeChar: '\\',
|
// stringEscapeChar: '\\',
|
||||||
stringEscapeChar: "'",
|
stringEscapeChar: "'",
|
||||||
fallbackDataType: 'varchar',
|
fallbackDataType: 'varchar',
|
||||||
|
|||||||
Reference in New Issue
Block a user