Thanks @josh - really good points!
We don’t have any plans to support adding column constraints natively in dbt, but some folks have made this work using post-hooks to add constraints. This might look like:
{{
config(
post_hook='create index if not exists "{{ this.name }}__index_on_COL_NAME" on {{ this }} ("COL_NAME")'
)
}}
We have a fledgling postgres package that implements these macros, which might be helpful here: https://github.com/fishtown-analytics/postgres
I haven’t used these macros before, but might be a good starting point!