drop_cluster.sql 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. -- Copyright Materialize, Inc. and contributors. All rights reserved.
  2. --
  3. -- Licensed under the Apache License, Version 2.0 (the "License");
  4. -- you may not use this file except in compliance with the License.
  5. -- You may obtain a copy of the License in the LICENSE file at the
  6. -- root of this repository, or online at
  7. --
  8. -- http://www.apache.org/licenses/LICENSE-2.0
  9. --
  10. -- Unless required by applicable law or agreed to in writing, software
  11. -- distributed under the License is distributed on an "AS IS" BASIS,
  12. -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. -- See the License for the specific language governing permissions and
  14. -- limitations under the License.
  15. {#
  16. -- This macro drops a cluster used in CI.
  17. -- Parameters:
  18. -- cluster_name (str): The name of the cluster to drop.
  19. #}
  20. {% macro drop_cluster(cluster_name) %}
  21. {%- if cluster_name -%}
  22. {{ log("Dropping cluster " ~ cluster_name ~ "...", info=True) }}
  23. {% call statement('drop_cluster') -%}
  24. DROP CLUSTER IF EXISTS {{ cluster_name }} CASCADE
  25. {%- endcall -%}
  26. {{ log("Cluster " ~ cluster_name ~ " dropped.", info=True) }}
  27. {%- else -%}
  28. {{ exceptions.raise_compiler_error("Invalid arguments. Missing cluster name!") }}
  29. {%- endif -%}
  30. {% endmacro %}