mirror of https://github.com/Fabio286/antares.git
refactor(PostgreSQL): preparing code to support triggers
This commit is contained in:
parent
1d363f755e
commit
86240fb53c
|
@ -16,6 +16,7 @@ module.exports = {
|
|||
tables: false,
|
||||
views: false,
|
||||
triggers: false,
|
||||
triggerFunctions: false,
|
||||
routines: false,
|
||||
functions: false,
|
||||
schedulers: false,
|
||||
|
@ -23,6 +24,7 @@ module.exports = {
|
|||
tableAdd: false,
|
||||
viewAdd: false,
|
||||
triggerAdd: false,
|
||||
triggerFunctionAdd: false,
|
||||
routineAdd: false,
|
||||
functionAdd: false,
|
||||
schedulerAdd: false,
|
||||
|
@ -31,6 +33,7 @@ module.exports = {
|
|||
tableSettings: false,
|
||||
viewSettings: false,
|
||||
triggerSettings: false,
|
||||
triggerFunctionSettings: false,
|
||||
routineSettings: false,
|
||||
functionSettings: false,
|
||||
schedulerSettings: false,
|
||||
|
@ -59,6 +62,8 @@ module.exports = {
|
|||
functionSql: false,
|
||||
functionContext: false,
|
||||
functionLanguage: false,
|
||||
triggerMiltipleEvents: false,
|
||||
triggerUpdateColumns: false,
|
||||
parametersLength: false,
|
||||
languages: false
|
||||
};
|
||||
|
|
|
@ -187,12 +187,14 @@ export class PostgreSQLClient extends AntaresCore {
|
|||
// TRIGGERS
|
||||
const remappedTriggers = triggersArr.filter(trigger => trigger.Db === db.database).map(trigger => {
|
||||
return {
|
||||
name: trigger.trigger_name,
|
||||
name: `${trigger.table_name}.${trigger.trigger_name}`,
|
||||
orgName: trigger.trigger_name,
|
||||
timing: trigger.activation,
|
||||
definer: trigger.definition, // ???
|
||||
definer: '',
|
||||
definition: trigger.definition,
|
||||
event: trigger.event,
|
||||
table: trigger.table_trigger,
|
||||
sqlMode: trigger.sql_mode
|
||||
table: trigger.table_name,
|
||||
sqlMode: ''
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -516,7 +518,8 @@ export class PostgreSQLClient extends AntaresCore {
|
|||
* @memberof PostgreSQLClient
|
||||
*/
|
||||
async dropTrigger (params) {
|
||||
const sql = `DROP TRIGGER \`${params.trigger}\``;
|
||||
const triggerParts = params.trigger.split('.');
|
||||
const sql = `DROP TRIGGER ${triggerParts[1]} ON ${triggerParts[0]}`;
|
||||
return await this.raw(sql);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue