destructive-op guard: prevent_destroy/protect for tables, MVs, dictionaries
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 15
- Forks
- 2
- Avg merge
- 1h 1m
- Merged PRs (30d)
- 27
Description
Symptom
Removing an object from HCL emits a runnable DROP TABLE with no guard. Only in-place-impossible changes are withheld from the SQL stream (internal/loader/hcl/sqlgen.go:168-174); intentional-looking drops are emitted as executable DDL. There is no Terraform-style prevent_destroy/protect mechanism.
Impact
An accidental deletion of a table block (bad merge, wrong layer resolution) generates a DROP that, once an apply path exists or an operator pipes the output, destroys data with no friction.
Fix direction
- A
protect = true(orlifecycle { prevent_destroy = true }) attribute on tables/MVs/dictionaries that turns a generated DROP into an error. - Optionally a global
-forbid-dropsflag for CI diff runs.
Found in the 2026-07-02 deep-dive audit (docs/plans/2026-07-02-deep-dive-improvement-areas.md, C2).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at internal/loader/hcl/sqlgen.go:168-174 and read the C2 entry in docs/plans/2026-07-02-deep-dive-improvement-areas.md. Trace how table, materialized view, and dictionary removals become DROP statements, then clarify whether the project should use protect, lifecycle prevent_destroy, the global -forbid-drops flag, or a combination. Done means the chosen guard prevents unintentional destructive output as an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100