Skip to content

Commit

Permalink
fix: make sure we are still pg10 compatible. (#5214)
Browse files Browse the repository at this point in the history
`EXECUTE FUNCTION` was introduced in Postgres v11. In Postgres v10 the
syntax was `EXECUTE PROCEDURE`. This fix changes the syntax to `EXECUTE
PROCEDURE`, which is perfectly fine sense our function does not return
anything.
  • Loading branch information
ivarconr authored Oct 30, 2023
1 parent 89d2b6f commit 50ddb36
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.up = function(db, cb) {
PRIMARY KEY (day, environment)
);
CREATE FUNCTION unleash_update_stat_environment_changes_counter() RETURNS trigger AS $unleash_update_changes_counter$
CREATE OR REPLACE FUNCTION unleash_update_stat_environment_changes_counter() RETURNS trigger AS $unleash_update_changes_counter$
BEGIN
IF NEW.environment IS NOT NULL THEN
INSERT INTO stat_environment_updates(day, environment, updates) SELECT DATE_TRUNC('Day', NEW.created_at), NEW.environment, 1 ON CONFLICT (day, environment) DO UPDATE SET updates = stat_environment_updates.updates + 1;
Expand All @@ -19,7 +19,7 @@ exports.up = function(db, cb) {
CREATE TRIGGER unleash_update_stat_environment_changes
AFTER INSERT ON events
FOR EACH ROW EXECUTE FUNCTION unleash_update_stat_environment_changes_counter();
FOR EACH ROW EXECUTE PROCEDURE unleash_update_stat_environment_changes_counter();
`, cb);
};

Expand Down

0 comments on commit 50ddb36

Please sign in to comment.