Skip to content

Commit

Permalink
update the dbosc templates to "CREATE OR REPLACE" routines (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
devhawk authored Jul 10, 2024
1 parent 3e7d4a0 commit d74ddab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/dbos-compiler/templates/dbos.create.liquid
Original file line number Diff line number Diff line change
@@ -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 $$
Expand Down Expand Up @@ -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 $$
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/dbos-compiler/templates/method.create.liquid
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/dbos-compiler/templates/module.create.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE FUNCTION "{{appVersion}}{{moduleName}}_init"() RETURNS VOID AS $$
CREATE OR REPLACE FUNCTION "{{appVersion}}{{moduleName}}_init"() RETURNS VOID AS $$

var exports = {};

Expand Down

0 comments on commit d74ddab

Please sign in to comment.