# `MishkaCmsCore.Runtime.Resources.Changes.ScheduleSiteTeardown`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__changes/schedule_site_teardown.ex#L5)

Schedules the background teardown of a site's in-memory artifacts on
`:permanent_destroy`.

A site's compiled modules and asset names are keyed by the site name, and its
child rows (pages/layouts/error pages/components) are removed by `ON DELETE
CASCADE` the moment the site row is deleted — bypassing Ash, so no per-record
job fires. This change therefore captures the module-backed record keys
**before** the delete, and on success closes the request gate
(`SiteState.delete/1`) and enqueues `SiteTeardownWorker` to purge the rest.

It sets `defer_runtime: true` so the generic `SendToOban` change skips the site
destroy job — teardown fully owns the permanent-delete path.

See `MishkaCmsCore.Runtime.Workers.SiteTeardownWorker` and
`MishkaCmsCore.Runtime.Resources.Changes.SendToOban`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
