tabl eoptions for mysql - comment, engine

This commit is contained in:
Jan Prochazka
2024-09-11 13:41:04 +02:00
parent 4f429c27c0
commit b0165c14e9
5 changed files with 81 additions and 3 deletions

View File

@@ -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;

View File

@@ -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];