1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: make sure we are still pg10 compatible. (#5214)

`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.
This commit is contained in:
Ivar Conradi Østhus 2023-10-30 13:19:57 +01:00 committed by GitHub
parent 89d2b6fee5
commit 50ddb365b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ exports.up = function(db, cb) {
PRIMARY KEY (day, environment) 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 BEGIN
IF NEW.environment IS NOT NULL THEN 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; 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;
@ -19,7 +19,7 @@ exports.up = function(db, cb) {
CREATE TRIGGER unleash_update_stat_environment_changes CREATE TRIGGER unleash_update_stat_environment_changes
AFTER INSERT ON events 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); `, cb);
}; };