mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 21:25:59 +00:00
tabl eoptions for mysql - comment, engine
This commit is contained in:
@@ -177,4 +177,8 @@ export const driverBase = {
|
|||||||
createSaveChangeSetScript(changeSet, dbinfo, defaultCreator) {
|
createSaveChangeSetScript(changeSet, dbinfo, defaultCreator) {
|
||||||
return defaultCreator(changeSet, dbinfo);
|
return defaultCreator(changeSet, dbinfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getTableFormOptions() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -164,7 +164,10 @@
|
|||||||
<ObjectFieldsEditor
|
<ObjectFieldsEditor
|
||||||
title="Table properties"
|
title="Table properties"
|
||||||
fieldDefinitions={tableFormOptions}
|
fieldDefinitions={tableFormOptions}
|
||||||
values={tableInfo}
|
values={_.pick(
|
||||||
|
tableInfo,
|
||||||
|
tableFormOptions.map(x => x.name)
|
||||||
|
)}
|
||||||
onChangeValues={vals => {
|
onChangeValues={vals => {
|
||||||
if (!_.isEmpty(vals)) {
|
if (!_.isEmpty(vals)) {
|
||||||
setTableInfo(tbl => ({ ...tbl, ...vals }));
|
setTableInfo(tbl => ({ ...tbl, ...vals }));
|
||||||
|
|||||||
@@ -118,11 +118,11 @@ const driver = {
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTableFormOptions: (intent) => {
|
getTableFormOptions(intent) {
|
||||||
const isNewTable = intent == 'newTableForm';
|
const isNewTable = intent == 'newTableForm';
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: isNewTable ? 'dropdowntext' : text,
|
type: isNewTable ? 'dropdowntext' : 'text',
|
||||||
options: clickhouseEngines,
|
options: clickhouseEngines,
|
||||||
label: 'Engine',
|
label: 'Engine',
|
||||||
name: 'tableEngine',
|
name: 'tableEngine',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ select
|
|||||||
TABLE_NAME as pureName,
|
TABLE_NAME as pureName,
|
||||||
TABLE_ROWS as tableRowCount,
|
TABLE_ROWS as tableRowCount,
|
||||||
ENGINE as tableEngine,
|
ENGINE as tableEngine,
|
||||||
|
TABLE_COMMENT as objectComment,
|
||||||
case when ENGINE='InnoDB' then CREATE_TIME else coalesce(UPDATE_TIME, CREATE_TIME) end as modifyDate
|
case when ENGINE='InnoDB' then CREATE_TIME else coalesce(UPDATE_TIME, CREATE_TIME) end as modifyDate
|
||||||
from information_schema.tables
|
from information_schema.tables
|
||||||
where TABLE_SCHEMA = '#DATABASE#' and (TABLE_TYPE='BASE TABLE' or TABLE_TYPE='SYSTEM VERSIONED') and TABLE_NAME =OBJECT_ID_CONDITION;
|
where TABLE_SCHEMA = '#DATABASE#' and (TABLE_TYPE='BASE TABLE' or TABLE_TYPE='SYSTEM VERSIONED') and TABLE_NAME =OBJECT_ID_CONDITION;
|
||||||
|
|||||||
@@ -132,6 +132,30 @@ const mysqlDriverBase = {
|
|||||||
{ label: 'New function', sql: 'CREATE FUNCTION myfunc (arg1 INT)\nRETURNS INT DETERMINISTIC\nRETURN 1' },
|
{ 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} */
|
/** @type {import('dbgate-types').EngineDriver} */
|
||||||
@@ -142,6 +166,27 @@ const mysqlDriver = {
|
|||||||
__analyserInternals: {
|
__analyserInternals: {
|
||||||
quoteDefaultValues: true,
|
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} */
|
/** @type {import('dbgate-types').EngineDriver} */
|
||||||
@@ -152,6 +197,31 @@ const mariaDriver = {
|
|||||||
__analyserInternals: {
|
__analyserInternals: {
|
||||||
quoteDefaultValues: false,
|
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];
|
module.exports = [mysqlDriver, mariaDriver];
|
||||||
|
|||||||
Reference in New Issue
Block a user