wheels destroy
Remove generated code and files.
Synopsis
Description
The wheels destroy
command reverses the actions of generator commands, removing files and code that were previously generated. It's useful for cleaning up mistakes or removing features.
Arguments
type
Type of resource to destroy
Yes
name
Name of the resource
Yes
Resource Types
controller
- Remove a controller and its viewsmodel
- Remove a modelview
- Remove a specific viewscaffold
- Remove entire scaffoldingmigration
- Remove a migration filetest
- Remove test files
Options
--force
Skip confirmation prompts
--dry-run
Show what would be removed without doing it
--help
Show help information
Examples
Remove a controller
Removes:
/controllers/Users.cfc
/views/users/
directory and all views
Remove a model
Removes:
/models/User.cfc
Related test files
Remove scaffolding
Removes:
/models/Product.cfc
/controllers/Products.cfc
/views/products/
directoryAll CRUD views
Test files
Remove a specific view
Removes:
/views/users/edit.cfm
Remove a migration
Removes:
Migration file from
/db/migrate/
Dry run to preview
Shows what would be removed without deleting
Force removal without confirmation
Confirmation
By default, the command asks for confirmation:
Safety Features
Confirmation Required: Always asks unless
--force
is usedDry Run Mode: Preview changes with
--dry-run
No Database Changes: Only removes files, not database tables
Git Awareness: Warns if files have uncommitted changes
What's NOT Removed
Database tables or columns
Routes (must be manually removed)
References in other files
Git history
Best Practices
Always use
--dry-run
firstCommit changes before destroying
Check for file dependencies
Update routes manually
Remove database tables separately
Common Workflows
Undo a scaffold
Clean up a mistake
Notes
Cannot be undone - files are permanently deleted
Does not remove custom code added to generated files
Works only with files created by generators
See Also
Last updated
Was this helpful?