mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-17 20:34:19 +08:00
✨ feat(sidebar): 创建数据库弹窗支持选择字符集与排序规则
MySQL 系连接创建数据库时,弹窗新增字符集与排序规则下拉,选项由 后端实时拉取;选择字符集后排序规则联动过滤。新增 supportsCreateDatabaseCharset 能力标记并同步 Wails 绑定。
This commit is contained in:
@@ -31,6 +31,18 @@ describe('dataSourceCapabilities', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('enables create-database charset options only for MySQL-family dialects', () => {
|
||||
expect(getDataSourceCapabilities({ type: 'mysql' }).supportsCreateDatabaseCharset).toBe(true);
|
||||
expect(getDataSourceCapabilities({ type: 'goldendb' }).supportsCreateDatabaseCharset).toBe(true);
|
||||
expect(getDataSourceCapabilities({ type: 'mariadb' }).supportsCreateDatabaseCharset).toBe(true);
|
||||
expect(getDataSourceCapabilities({ type: 'oceanbase', oceanBaseProtocol: 'mysql' }).supportsCreateDatabaseCharset).toBe(true);
|
||||
expect(getDataSourceCapabilities({ type: 'diros' }).supportsCreateDatabaseCharset).toBe(true);
|
||||
expect(getDataSourceCapabilities({ type: 'postgres' }).supportsCreateDatabaseCharset).toBe(false);
|
||||
expect(getDataSourceCapabilities({ type: 'sqlserver' }).supportsCreateDatabaseCharset).toBe(false);
|
||||
expect(getDataSourceCapabilities({ type: 'clickhouse' }).supportsCreateDatabaseCharset).toBe(false);
|
||||
expect(getDataSourceCapabilities({ type: 'starrocks' }).supportsCreateDatabaseCharset).toBe(false);
|
||||
});
|
||||
|
||||
it('uses ClickHouse capabilities for a custom ClickHouse JDBC connection', () => {
|
||||
expect(getDataSourceCapabilities({ type: 'custom', driver: 'clickhouse' })).toMatchObject({
|
||||
type: 'clickhouse',
|
||||
|
||||
@@ -205,6 +205,7 @@ export type DataSourceCapabilities = {
|
||||
supportsCopyInsert: boolean;
|
||||
supportsCopyTable: boolean;
|
||||
supportsCreateDatabase: boolean;
|
||||
supportsCreateDatabaseCharset: boolean;
|
||||
supportsRenameDatabase: boolean;
|
||||
supportsDropDatabase: boolean;
|
||||
supportsMessagePublish: boolean;
|
||||
@@ -233,6 +234,15 @@ const CREATE_DATABASE_TYPES = new Set([
|
||||
'clickhouse',
|
||||
]);
|
||||
|
||||
// MySQL 系方言支持在建库时指定字符集与排序规则。
|
||||
const CREATE_DATABASE_CHARSET_TYPES = new Set([
|
||||
'mysql',
|
||||
'goldendb',
|
||||
'mariadb',
|
||||
'oceanbase',
|
||||
'diros',
|
||||
]);
|
||||
|
||||
const RENAME_DATABASE_TYPES = new Set([
|
||||
'diros',
|
||||
'postgres',
|
||||
@@ -278,6 +288,8 @@ export const getDataSourceCapabilities = (config: ConnectionLike): DataSourceCap
|
||||
!structureEditRestricted &&
|
||||
COPY_TABLE_TYPES.has(type),
|
||||
supportsCreateDatabase: !structureEditRestricted && CREATE_DATABASE_TYPES.has(type),
|
||||
supportsCreateDatabaseCharset:
|
||||
!structureEditRestricted && CREATE_DATABASE_CHARSET_TYPES.has(type),
|
||||
supportsRenameDatabase: !structureEditRestricted && RENAME_DATABASE_TYPES.has(type),
|
||||
supportsDropDatabase: !structureEditRestricted && DROP_DATABASE_TYPES.has(type),
|
||||
supportsMessagePublish: !dataEditRestricted && MESSAGE_PUBLISH_TYPES.has(type),
|
||||
|
||||
Reference in New Issue
Block a user