mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
non default schema name in tab title
This commit is contained in:
parent
b2204e1d77
commit
53b6b71a29
@ -16,6 +16,7 @@ const dialect = {
|
||||
isSparse: false,
|
||||
isPersisted: false,
|
||||
},
|
||||
defaultSchemaName: null,
|
||||
};
|
||||
|
||||
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;
|
||||
explicitDropConstraint?: boolean;
|
||||
anonymousPrimaryKey?: boolean;
|
||||
defaultSchemaName?: string;
|
||||
enableConstraintsPerTable?: boolean;
|
||||
|
||||
dropColumnDependencies?: string[];
|
||||
|
@ -9,7 +9,7 @@
|
||||
schemaName,
|
||||
...(columns?.map(({ columnName }) => ({ childName: columnName })) || [])
|
||||
);
|
||||
export const createTitle = ({ pureName }) => pureName;
|
||||
export const createTitle = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||
|
||||
export const databaseObjectIcons = {
|
||||
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(
|
||||
tabComponent,
|
||||
scriptTemplate,
|
||||
@ -603,7 +613,7 @@
|
||||
|
||||
openNewTab(
|
||||
{
|
||||
title: scriptTemplate ? 'Query #' : pureName,
|
||||
title: scriptTemplate ? 'Query #' : getObjectTitle(connection, schemaName, pureName),
|
||||
tooltip,
|
||||
icon: icon || (scriptTemplate ? 'img sql-file' : databaseObjectIcons[objectTypeField]),
|
||||
tabComponent: scriptTemplate ? 'QueryTab' : tabComponent,
|
||||
|
@ -10,6 +10,7 @@ const dialect = {
|
||||
rangeSelect: true,
|
||||
offsetFetchRangeSyntax: true,
|
||||
rowNumberOverPaging: true,
|
||||
defaultSchemaName: 'dbo',
|
||||
stringEscapeChar: "'",
|
||||
fallbackDataType: 'nvarchar(max)',
|
||||
explicitDropConstraint: false,
|
||||
|
@ -8,6 +8,7 @@ const spatialTypes = ['GEOGRAPHY'];
|
||||
const dialect = {
|
||||
rangeSelect: true,
|
||||
ilike: true,
|
||||
defaultSchemaName: 'public',
|
||||
// stringEscapeChar: '\\',
|
||||
stringEscapeChar: "'",
|
||||
fallbackDataType: 'varchar',
|
||||
|
Loading…
Reference in New Issue
Block a user