-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cacd87
commit 98787a2
Showing
4 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
-- add enum {{name}} | ||
-- add enum {{escapeIdentifier name}} | ||
DO $$ | ||
BEGIN | ||
BEGIN | ||
CREATE TYPE {{name}} AS ENUM ( | ||
CREATE TYPE {{escapeIdentifier name}} AS ENUM ( | ||
{{#values}} | ||
'{{this}}'{{#unless @last}},{{/unless}} | ||
{{escapeLiteral this}}{{#unless @last}},{{/unless}} | ||
{{/values}} | ||
); | ||
EXCEPTION | ||
WHEN duplicate_object | ||
THEN RAISE EXCEPTION 'Enum ''{{name}}'' already exists'; | ||
THEN RAISE EXCEPTION 'Enum '{{escapeLiteral name}}' already exists'; | ||
END; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
$$ LANGUAGE plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters