optimism-models/macros/change_tracking.sql
2025-07-24 09:54:24 -06:00

9 lines
363 B
SQL

{% macro enable_change_tracking() %}
{% if 'exclude_change_tracking' not in config.get('tags') and var('ENABLE_CHANGE_TRACKING', false) %}
{% if config.get('materialized') == 'view' %}
ALTER VIEW {{ this }} SET CHANGE_TRACKING = TRUE;
{% else %}
ALTER TABLE {{ this }} SET CHANGE_TRACKING = TRUE;
{% endif %}
{% endif %}
{% endmacro %}