LogoLogo
HomeAPIBlog
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT
  • INTRODUCTION
    • Getting Started
      • Running Local Development Servers
      • Beginner Tutorial: Hello World
      • Beginner Tutorial: Hello Database
      • Tutorial: Wheels, AJAX, and You
    • Frameworks and Wheels
    • Requirements
    • Manual Installation
    • Upgrading
    • Screencasts
  • Command Line Tools
    • CLI Overview
    • Quick Start Guide
    • Command Reference
      • Core Commands
        • wheels init
        • wheels info
        • wheels reload
        • wheels deps
        • wheels destroy
        • wheels watch
      • Code Generation
        • wheels generate app
        • wheels generate app-wizard
        • wheels generate controller
        • wheels generate model
        • wheels generate view
        • wheels generate property
        • wheels generate route
        • wheels generate resource
        • wheels generate api-resource
        • wheels generate frontend
        • wheels generate test
        • wheels generate snippets
        • wheels scaffold
      • Database Commands
        • wheels dbmigrate info
        • wheels dbmigrate latest
        • wheels dbmigrate up
        • wheels dbmigrate down
        • wheels dbmigrate reset
        • wheels dbmigrate exec
        • wheels dbmigrate create blank
        • wheels dbmigrate create table
        • wheels dbmigrate create column
        • wheels dbmigrate remove table
        • wheels db schema
        • wheels db seed
      • Testing Commands
        • wheels test
        • wheels test run
        • wheels test coverage
        • wheels test debug
      • Configuration Commands
        • wheels config list
        • wheels config set
        • wheels config env
      • Environment Management
        • wheels env
        • wheels env setup
        • wheels env list
        • wheels env switch
      • Plugin Management
        • wheels plugins
        • wheels plugins list
        • wheels plugins install
        • wheels plugins remove
      • Code Analysis
        • wheels analyze
        • wheels analyze code
        • wheels analyze performance
        • wheels analyze security
      • Security Commands
        • wheels security
        • wheels security scan
      • Performance Commands
        • wheels optimize
        • wheels optimize performance
      • Documentation Commands
        • wheels docs
        • wheels docs generate
        • wheels docs serve
      • CI/CD Commands
        • wheels ci init
      • Docker Commands
        • wheels docker init
        • wheels docker deploy
      • Deployment Commands
        • wheels deploy
        • wheels deploy audit
        • wheels deploy exec
        • wheels deploy hooks
        • wheels deploy init
        • wheels deploy lock
        • wheels deploy logs
        • wheels deploy proxy
        • wheels deploy push
        • wheels deploy rollback
        • wheels deploy secrets
        • wheels deploy setup
        • wheels deploy status
        • wheels deploy stop
    • CLI Development Guides
      • Creating Commands
      • Service Architecture
      • Migrations Guide
      • Testing Guide
  • Working with Wheels
    • Conventions
    • Configuration and Defaults
    • Directory Structure
    • Switching Environments
    • Testing Your Application
    • Using the Test Environment
    • Contributing to Wheels
    • Submitting Pull Requests
    • Documenting your Code
  • Handling Requests with Controllers
    • Request Handling
    • Rendering Content
    • Redirecting Users
    • Sending Files
    • Sending Email
    • Responding with Multiple Formats
    • Using the Flash
    • Using Filters
    • Verification
    • Event Handlers
    • Routing
    • URL Rewriting
      • Apache
      • IIS
      • Tomcat
      • Nginx
    • Obfuscating URLs
    • Caching
    • Nesting Controllers
    • CORS Requests
  • Displaying Views to Users
    • Pages
    • Partials
    • Linking Pages
    • Layouts
    • Form Helpers and Showing Errors
    • Displaying Links for Pagination
    • Date, Media, and Text Helpers
    • Creating Custom View Helpers
    • Localization
  • Database Interaction Through Models
    • Object Relational Mapping
    • Creating Records
    • Reading Records
    • Updating Records
    • Deleting Records
    • Column Statistics
    • Dynamic Finders
    • Getting Paginated Data
    • Associations
    • Nested Properties
    • Object Validation
    • Object Callbacks
    • Calculated Properties
    • Transactions
    • Dirty Records
    • Soft Delete
    • Automatic Time Stamps
    • Database Migrations
      • Migrations in Production
    • Using Multiple Data Sources
  • Plugins
    • Installing and Using Plugins
    • Developing Plugins
    • Publishing Plugins
  • Project Documentation
    • Overview
  • External Links
    • Source Code
    • Issue Tracker
    • Sponsor Us
    • Community
Powered by GitBook
LogoLogo
On this page
  • Synopsis
  • Description
  • Arguments
  • Resource Types
  • Options
  • Examples
  • Remove a controller
  • Remove a model
  • Remove scaffolding
  • Remove a specific view
  • Remove a migration
  • Dry run to preview
  • Force removal without confirmation
  • Confirmation
  • Safety Features
  • What's NOT Removed
  • Best Practices
  • Common Workflows
  • Undo a scaffold
  • Clean up a mistake
  • Notes
  • See Also

Was this helpful?

Edit on GitHub
Export as PDF
  1. Command Line Tools
  2. Command Reference
  3. Core Commands

wheels destroy

Remove generated code and files.

Synopsis

wheels destroy [type] [name] [options]

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

Argument
Description
Required

type

Type of resource to destroy

Yes

name

Name of the resource

Yes

Resource Types

  • controller - Remove a controller and its views

  • model - Remove a model

  • view - Remove a specific view

  • scaffold - Remove entire scaffolding

  • migration - Remove a migration file

  • test - Remove test files

Options

Option
Description

--force

Skip confirmation prompts

--dry-run

Show what would be removed without doing it

--help

Show help information

Examples

Remove a controller

wheels destroy controller users

Removes:

  • /controllers/Users.cfc

  • /views/users/ directory and all views

Remove a model

wheels destroy model user

Removes:

  • /models/User.cfc

  • Related test files

Remove scaffolding

wheels destroy scaffold product

Removes:

  • /models/Product.cfc

  • /controllers/Products.cfc

  • /views/products/ directory

  • All CRUD views

  • Test files

Remove a specific view

wheels destroy view users/edit

Removes:

  • /views/users/edit.cfm

Remove a migration

wheels destroy migration CreateUsersTable

Removes:

  • Migration file from /db/migrate/

Dry run to preview

wheels destroy scaffold order --dry-run

Shows what would be removed without deleting

Force removal without confirmation

wheels destroy model tempdata --force

Confirmation

By default, the command asks for confirmation:

The following files will be removed:
- /models/User.cfc
- /tests/models/UserTest.cfc

Are you sure you want to proceed? (y/N):

Safety Features

  1. Confirmation Required: Always asks unless --force is used

  2. Dry Run Mode: Preview changes with --dry-run

  3. No Database Changes: Only removes files, not database tables

  4. 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

  1. Always use --dry-run first

  2. Commit changes before destroying

  3. Check for file dependencies

  4. Update routes manually

  5. Remove database tables separately

Common Workflows

Undo a scaffold

# First, see what would be removed
wheels destroy scaffold product --dry-run

# If okay, proceed
wheels destroy scaffold product

# Remove the database table
wheels dbmigrate create remove_table products
wheels dbmigrate latest

Clean up a mistake

# Accidentally created wrong controller
wheels generate controller userss  # Oops, typo!
wheels destroy controller userss   # Fix it
wheels generate controller users   # Create correct one

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

Previouswheels depsNextwheels watch

Last updated 2 days ago

Was this helpful?

- Generate controllers

- Generate models

- Generate scaffolding

wheels generate controller
wheels generate model
wheels scaffold