mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
feat(PostgreSQL): ability to switch the database, closes #432
This commit is contained in:
@ -154,7 +154,7 @@ export class PostgreSQLClient extends AntaresCore {
|
||||
host: this._params.host,
|
||||
port: this._params.port,
|
||||
user: this._params.user,
|
||||
database: undefined as string | undefined,
|
||||
database: 'postgres' as string,
|
||||
password: this._params.password,
|
||||
ssl: null as mysql.SslOptions
|
||||
};
|
||||
@ -262,6 +262,18 @@ export class PostgreSQLClient extends AntaresCore {
|
||||
return [];
|
||||
}
|
||||
|
||||
async getDatabases () {
|
||||
const { rows } = await this.raw('SELECT datname FROM pg_database WHERE datistemplate = false');
|
||||
if (rows) {
|
||||
return rows.reduce((acc, cur) => {
|
||||
acc.push(cur.datname);
|
||||
return acc;
|
||||
}, [] as string[]);
|
||||
}
|
||||
else
|
||||
return [];
|
||||
}
|
||||
|
||||
async getStructure (schemas: Set<string>) {
|
||||
/* eslint-disable camelcase */
|
||||
interface ShowTableResult {
|
||||
|
Reference in New Issue
Block a user