diff --git a/packages/dbos-compiler/templates/dbos.create.liquid b/packages/dbos-compiler/templates/dbos.create.liquid index 014cc2c2f..9913b150d 100644 --- a/packages/dbos-compiler/templates/dbos.create.liquid +++ b/packages/dbos-compiler/templates/dbos.create.liquid @@ -1,7 +1,7 @@ CREATE EXTENSION IF NOT EXISTS plv8; CREATE SCHEMA IF NOT EXISTS dbos; -CREATE FUNCTION dbos.{{appVersion}}check_execution(_workflow_uuid TEXT, _function_id INT, preset BOOLEAN) +CREATE OR REPLACE FUNCTION dbos.{{appVersion}}check_execution(_workflow_uuid TEXT, _function_id INT, preset BOOLEAN) RETURNS JSONB LANGUAGE plpgsql AS $$ @@ -30,7 +30,7 @@ BEGIN END; $$; -CREATE FUNCTION dbos.{{appVersion}}flush_buffered_results( +CREATE OR REPLACE FUNCTION dbos.{{appVersion}}flush_buffered_results( workflow_uuid TEXT, buffered_results JSONB ) RETURNS void AS $$ @@ -44,7 +44,7 @@ CREATE FUNCTION dbos.{{appVersion}}flush_buffered_results( } $$ LANGUAGE plv8; -CREATE FUNCTION dbos.{{appVersion}}run_init() RETURNS VOID AS $$ +CREATE OR REPLACE FUNCTION dbos.{{appVersion}}run_init() RETURNS VOID AS $$ function $run(workflow_uuid, _context, $func) { try { diff --git a/packages/dbos-compiler/templates/method.create.liquid b/packages/dbos-compiler/templates/method.create.liquid index 4cbfab966..d410b594b 100644 --- a/packages/dbos-compiler/templates/method.create.liquid +++ b/packages/dbos-compiler/templates/method.create.liquid @@ -1,4 +1,4 @@ -CREATE FUNCTION "{{appVersion}}{{className}}_{{methodName}}_f"( +CREATE OR REPLACE FUNCTION "{{appVersion}}{{className}}_{{methodName}}_f"( _workflow_uuid TEXT, _context JSONB, _params JSONB @@ -14,7 +14,7 @@ CREATE FUNCTION "{{appVersion}}{{className}}_{{methodName}}_f"( $$ LANGUAGE plv8; -CREATE PROCEDURE "{{appVersion}}{{className}}_{{methodName}}_p"( +CREATE OR REPLACE PROCEDURE "{{appVersion}}{{className}}_{{methodName}}_p"( {% unless readOnly %}buffered_results JSONB,{% endunless %} _workflow_uuid TEXT, _function_id INT, diff --git a/packages/dbos-compiler/templates/module.create.liquid b/packages/dbos-compiler/templates/module.create.liquid index bc182a4ca..cd977aa28 100644 --- a/packages/dbos-compiler/templates/module.create.liquid +++ b/packages/dbos-compiler/templates/module.create.liquid @@ -1,4 +1,4 @@ -CREATE FUNCTION "{{appVersion}}{{moduleName}}_init"() RETURNS VOID AS $$ +CREATE OR REPLACE FUNCTION "{{appVersion}}{{moduleName}}_init"() RETURNS VOID AS $$ var exports = {};