34 lines
892 B
Cheetah
34 lines
892 B
Cheetah
{{/* Base DDL template with common structure */}}
|
|
{{- define "ddl_header" -}}
|
|
-- DDL Operation: {{comment_text .Operation}}
|
|
-- Schema: {{comment_text .Schema}}
|
|
-- Object: {{comment_text .ObjectName}}
|
|
{{- end -}}
|
|
|
|
{{- define "ddl_footer" -}}
|
|
-- End of {{comment_text .Operation}}
|
|
{{- end -}}
|
|
|
|
{{/* Base ALTER TABLE structure */}}
|
|
{{- define "alter_table_base" -}}
|
|
ALTER TABLE {{qual_table .SchemaName .TableName}}
|
|
{{block "alter_operation" .}}{{end}};
|
|
{{- end -}}
|
|
|
|
{{/* Common existence check pattern */}}
|
|
{{- define "exists_check" -}}
|
|
DO {{dollar_delimiter}}
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
{{block "exists_query" .}}{{end}}
|
|
) THEN
|
|
{{block "create_statement" .}}{{end}}
|
|
END IF;
|
|
END;
|
|
{{dollar_delimiter}};
|
|
{{- end -}}
|
|
|
|
{{/* Common drop pattern */}}
|
|
{{- define "drop_if_exists" -}}
|
|
{{block "drop_type" .}}{{end}} IF EXISTS {{qual_table .SchemaName .ObjectName}};
|
|
{{- end -}} |