Skip to content

Command Line Tools

Scaffold Cleanup

wheels destroy is the reverse of wheels generate. You hand it the same name you handed generate and it removes the files that were written. wheels d is a one-letter alias for the same command.

You’ll use this for:

  • Undoing a scaffold you ran against the wrong name and want to redo.
  • Removing an individual generated artifact — a model, a controller, a view directory — without touching the rest of the project.
  • Cleaning up half-generated work when a generate run didn’t match what you meant to type.

destroy mirrors a subset of the generate surface. For each supported type it removes the files the matching generator wrote, drops the corresponding .resources() line from config/routes.cfm when relevant, and stamps out a remove_<table>_table migration for types that own a schema. Files that weren’t generated — or that have already been removed — are reported as skipped, not errors.

wheels d is the same function under a shorter name. Every example on this page works with either destroy or d.

illustrative — synopsis
wheels destroy <name> [type] [--force]
wheels d <name> [type] [--force]

The first positional argument is the resource name. The second, optional, is the type — resource (the default), model, controller, or view. --force must be passed for any deletion to actually occur; without it, destroy prints the preview and exits.

Running wheels destroy with no arguments prints the usage block and supported types.

destroy handles four types. This is narrower than generate — there is no destroy scaffold, destroy migration, or destroy helper. Use resource (the default) for the full CRUD surface that generate scaffold writes.

TypeWhat it removes
resource (default)Model CFC, controller CFC, views directory, model spec, controller spec, view-tests directory, .resources() route line, plus a new drop-table migration file
modelModel CFC, model spec, plus a new drop-table migration file
controllerController CFC and controller spec
viewEntire view directory and its matching view-tests directory — or a single view file if you pass a controller/action path
FlagDefaultDescription
--forceoffRequired to actually delete. Without --force, destroy prints the preview and exits.
illustrative — preview then force
wheels destroy Post
# preview prints; nothing deleted yet
wheels destroy Post --force

The second command removes app/models/Post.cfc, app/controllers/Posts.cfc, app/views/posts/, tests/specs/models/PostSpec.cfc, tests/specs/controllers/PostsControllerSpec.cfc, tests/specs/views/posts/, and the .resources("posts") line from config/routes.cfm. It also writes a new <timestamp>_remove_posts_table.cfc migration into app/migrator/migrations/ — you still need to run wheels migrate latest to actually drop the table from the database.

illustrative — undo scaffold
wheels destroy Post --force
wheels migrate latest # apply the generated drop-table migration

Removes every file wheels generate scaffold Post wrote, clears its route, and — after the migrate — drops the posts table.

illustrative — clean up aborted work
wheels destroy User model --force
wheels destroy Users controller --force

Useful when you ran wheels generate model and wheels generate controller separately, realised you named them wrong, and want to back out both without touching anything else. Each invocation is independent and prints its own preview when --force is omitted.

illustrative — re-scaffold under new name
wheels destroy Post --force
wheels migrate latest
wheels generate scaffold Article title body:text
wheels migrate latest

Tear down the old resource, apply the drop-table migration, and generate the new one. The two migrate runs keep the schema aligned with the filesystem at each step.