diff --git a/packages/tools/src/driverBase.ts b/packages/tools/src/driverBase.ts index e67433fc3..3c9c8d8f1 100644 --- a/packages/tools/src/driverBase.ts +++ b/packages/tools/src/driverBase.ts @@ -177,4 +177,8 @@ export const driverBase = { createSaveChangeSetScript(changeSet, dbinfo, defaultCreator) { return defaultCreator(changeSet, dbinfo); }, + + getTableFormOptions() { + return null; + }, }; diff --git a/packages/web/src/tableeditor/TableEditor.svelte b/packages/web/src/tableeditor/TableEditor.svelte index 27d24d5a2..aa8e6cb19 100644 --- a/packages/web/src/tableeditor/TableEditor.svelte +++ b/packages/web/src/tableeditor/TableEditor.svelte @@ -164,7 +164,10 @@ x.name) + )} onChangeValues={vals => { if (!_.isEmpty(vals)) { setTableInfo(tbl => ({ ...tbl, ...vals })); diff --git a/plugins/dbgate-plugin-clickhouse/src/frontend/driver.js b/plugins/dbgate-plugin-clickhouse/src/frontend/driver.js index 2d24f47aa..baff6fa23 100644 --- a/plugins/dbgate-plugin-clickhouse/src/frontend/driver.js +++ b/plugins/dbgate-plugin-clickhouse/src/frontend/driver.js @@ -118,11 +118,11 @@ const driver = { return res; }, - getTableFormOptions: (intent) => { + getTableFormOptions(intent) { const isNewTable = intent == 'newTableForm'; return [ { - type: isNewTable ? 'dropdowntext' : text, + type: isNewTable ? 'dropdowntext' : 'text', options: clickhouseEngines, label: 'Engine', name: 'tableEngine', diff --git a/plugins/dbgate-plugin-mysql/src/backend/sql/tables.js b/plugins/dbgate-plugin-mysql/src/backend/sql/tables.js index 993f9dbbc..216e8c43b 100644 --- a/plugins/dbgate-plugin-mysql/src/backend/sql/tables.js +++ b/plugins/dbgate-plugin-mysql/src/backend/sql/tables.js @@ -3,6 +3,7 @@ select TABLE_NAME as pureName, TABLE_ROWS as tableRowCount, ENGINE as tableEngine, + TABLE_COMMENT as objectComment, case when ENGINE='InnoDB' then CREATE_TIME else coalesce(UPDATE_TIME, CREATE_TIME) end as modifyDate from information_schema.tables where TABLE_SCHEMA = '#DATABASE#' and (TABLE_TYPE='BASE TABLE' or TABLE_TYPE='SYSTEM VERSIONED') and TABLE_NAME =OBJECT_ID_CONDITION; diff --git a/plugins/dbgate-plugin-mysql/src/frontend/drivers.js b/plugins/dbgate-plugin-mysql/src/frontend/drivers.js index 80e7c6869..8b49c9451 100644 --- a/plugins/dbgate-plugin-mysql/src/frontend/drivers.js +++ b/plugins/dbgate-plugin-mysql/src/frontend/drivers.js @@ -132,6 +132,30 @@ const mysqlDriverBase = { { label: 'New function', sql: 'CREATE FUNCTION myfunc (arg1 INT)\nRETURNS INT DETERMINISTIC\nRETURN 1' }, ]; }, + + getSupportedEngines() { + return []; + }, + + getTableFormOptions(intent) { + const isNewTable = intent == 'newTableForm'; + return [ + { + type: isNewTable ? 'dropdowntext' : 'text', + options: this.getSupportedEngines(), + label: 'Engine', + name: 'tableEngine', + sqlFormatString: '^engine = %s', + disabled: !isNewTable, + }, + { + type: 'text', + label: 'Comment', + name: 'objectComment', + sqlFormatString: '^comment %v', + }, + ]; + }, }; /** @type {import('dbgate-types').EngineDriver} */ @@ -142,6 +166,27 @@ const mysqlDriver = { __analyserInternals: { quoteDefaultValues: true, }, + + getSupportedEngines() { + const mysqlEngines = [ + 'InnoDB', // Default and most commonly used engine with ACID transaction support and referential integrity. + 'MyISAM', // Older engine without transaction or referential integrity support. + 'MEMORY', // Tables stored in memory, very fast but volatile, used for temporary data. + 'CSV', // Tables stored in CSV format, useful for import/export of data. + 'ARCHIVE', // Engine for storing large amounts of historical data with compression. + 'BLACKHOLE', // Engine that discards data, useful for replication. + 'FEDERATED', // Access tables on remote MySQL servers. + 'MRG_MYISAM', // Merges multiple MyISAM tables into one. + 'NDB', // Cluster storage engine for MySQL Cluster. + 'EXAMPLE', // Example engine for developers, has no real functionality. + 'PERFORMANCE_SCHEMA', // Engine used for performance monitoring in MySQL. + 'SEQUENCE', // Special engine for sequences, used in MariaDB. + 'SPIDER', // Engine for horizontal partitioning, often used in MariaDB. + 'ROCKSDB', // Engine optimized for read-heavy workloads, commonly used in Facebook MySQL. + 'TokuDB', // Engine with high data compression and SSD optimization. + ]; + return mysqlEngines; + }, }; /** @type {import('dbgate-types').EngineDriver} */ @@ -152,6 +197,31 @@ const mariaDriver = { __analyserInternals: { quoteDefaultValues: false, }, + getSupportedEngines() { + const mariaDBEngines = [ + 'InnoDB', // Main transactional engine, similar to MySQL, supports ACID transactions and referential integrity. + 'Aria', // Replacement for MyISAM, supports crash recovery and optimized for high speed. + 'MyISAM', // Older engine without transaction support, still supported for compatibility. + 'MEMORY', // Tables stored in memory, suitable for temporary data. + 'CSV', // Stores data in CSV format, easy for export/import. + 'ARCHIVE', // Stores compressed data, suitable for historical records. + 'BLACKHOLE', // Engine that does not store data, often used for replication. + 'FEDERATED', // Allows access to tables on remote MariaDB/MySQL servers. + 'MRG_MyISAM', // Allows merging multiple MyISAM tables into one. + 'SEQUENCE', // Special engine for generating sequences. + 'SphinxSE', // Engine for full-text search using Sphinx. + 'SPIDER', // Engine for sharding, supports horizontal partitioning. + 'TokuDB', // High-compression engine optimized for large data sets and SSDs. + 'RocksDB', // Read-optimized engine focused on performance with large data. + 'CONNECT', // Engine for accessing external data sources (e.g., files, web services). + 'OQGRAPH', // Graph engine, suitable for hierarchical and graph structures. + 'ColumnStore', // Analytical engine for columnar data storage, suitable for Big Data. + 'Mroonga', // Engine supporting full-text search in Japanese and other languages. + 'S3', // Allows storing data in Amazon S3-compatible storage. + 'XtraDB', // Enhanced InnoDB engine with optimizations from Percona (commonly used in older MariaDB versions). + ]; + return mariaDBEngines; + }, }; module.exports = [mysqlDriver, mariaDriver];