mirror of
https://github.com/Fabio286/antares.git
synced 2025-04-13 17:52:04 +02:00
26 lines
678 B
JavaScript
26 lines
678 B
JavaScript
'use strict';
|
|
export default class {
|
|
static testConnection (connection) {
|
|
return connection.select('1+1').run();
|
|
}
|
|
|
|
static getStructure (connection) {
|
|
return connection
|
|
.select('*')
|
|
.schema('information_schema')
|
|
.from('TABLES')
|
|
.orderBy({ TABLE_SCHEMA: 'ASC', TABLE_NAME: 'ASC' })
|
|
.run();
|
|
}
|
|
|
|
static getTableColumns (connection, schema, table) {
|
|
return connection
|
|
.select('*')
|
|
.schema('information_schema')
|
|
.from('COLUMNS')
|
|
.where({ TABLE_SCHEMA: `= '${schema}'`, TABLE_NAME: `= '${table}'` })
|
|
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
|
.run();
|
|
}
|
|
}
|