From d2c5440e39c24618d5c8288d39329dab0c75ae4c Mon Sep 17 00:00:00 2001 From: Nybkox Date: Thu, 19 Dec 2024 08:33:26 +0100 Subject: [PATCH] feat: pssql tirgger test --- integration-tests/engines.js | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/integration-tests/engines.js b/integration-tests/engines.js index 485698d04..dbe4c2e6e 100644 --- a/integration-tests/engines.js +++ b/integration-tests/engines.js @@ -288,6 +288,50 @@ end;$$`, ], }, ], + triggers: [ + { + testName: 'triggers after each row', + create: `CREATE TRIGGER obj1 +BEFORE INSERT ON t1 +FOR EACH ROW +EXECUTE FUNCTION test_function(); +`, + drop: 'DROP TRIGGER obj1;', + triggerOtherCreateSql: `CREATE OR REPLACE FUNCTION test_function() +RETURNS TRIGGER AS $$ +BEGIN +END; +$$ LANGUAGE plpgsql;`, + triggerOtherDropSql: 'DROP FUNCTION test_function', + objectTypeField: 'triggers', + expected: { + pureName: 'obj1', + eventType: 'insert', + triggerTiming: 'after', + }, + }, + { + testName: 'triggers before each row', + create: `CREATE TRIGGER obj1 +BEFORE INSERT ON t1 +FOR EACH ROW +EXECUTE FUNCTION test_function(); +`, + drop: 'DROP TRIGGER obj1;', + triggerOtherCreateSql: `CREATE OR REPLACE FUNCTION test_function() +RETURNS TRIGGER AS $$ +BEGIN +END; +$$ LANGUAGE plpgsql;`, + triggerOtherDropSql: 'DROP FUNCTION test_function', + objectTypeField: 'triggers', + expected: { + pureName: 'obj1', + eventType: 'insert', + triggerTiming: 'before', + }, + }, + ], }, { label: 'SQL Server',