Skip to content

Commit

Permalink
feat(database.sql): add values constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
rimrakhimov committed Sep 1, 2024
1 parent 182b0c4 commit 657300e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -374,23 +374,26 @@ CREATE OR REPLACE FUNCTION validate_creation_values(obj jsonb)
RETURNS boolean AS
$$
BEGIN
RETURN validate_json_object_keys(
obj,
array []::text[],
array ['libraries', 'cborAuxdata', 'constructorArguments']
);
RETURN
is_object(obj) AND
validate_json_object_keys(
obj,
array []::text[],
array ['libraries', 'cborAuxdata', 'constructorArguments']
);
END;
$$ LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION validate_runtime_values(obj jsonb)
RETURNS boolean AS
$$
BEGIN
RETURN validate_json_object_keys(
obj,
array []::text[],
array ['libraries', 'cborAuxdata', 'immutables', 'callProtection']
);
RETURN is_object(obj) AND
validate_json_object_keys(
obj,
array []::text[],
array ['libraries', 'cborAuxdata', 'immutables', 'callProtection']
);
END;
$$ LANGUAGE plpgsql;

Expand Down

0 comments on commit 657300e

Please sign in to comment.