LogoLogo
8.2.0
8.2.0
  • Introduction
  • What's New?
  • Installation & Usage
  • Migration Guide
  • Contributing & Filing Issues
  • Query Builder
    • Getting a New Query
    • Building Queries
      • Selects
      • From
      • Joins
      • Wheres
      • Order By
      • Group By and Having
      • Limit, Offset, and Pagination
      • Unions
      • Common Table Expressions (i.e. CTEs)
      • Raw Expressions
      • When / Conditionals
      • Query Parameters and Bindings
    • Executing Queries
      • Retrieving Results
      • Aggregates
      • Inserts, Updates, and Deletes
    • Options and Utilities
      • Query Options
      • Clone
      • Return Format
      • Column Formatter
      • Parent Query
      • Interception Points
    • Debugging
  • Schema Builder
    • Overview
    • Create
    • Columns
    • Column Modifiers
    • Column Constraints
    • Creating Table Constraints
    • Alter
    • Drop
  • External Links
    • API Docs
    • Source Code
    • Issue Tracker
Powered by GitBook
On this page
  • drop
  • dropIfExists

Was this helpful?

Edit on Git
Export as PDF
  1. Schema Builder

Drop

PreviousAlter

Last updated 7 years ago

Was this helpful?

Dropping tables straightforward in qb.

For dropping columns or constraints, see .

drop

Drop a table from the database.

Argument

Type

Required

Default

Description

table

string

true

The name of the table to drop.

options

struct

false

{}

Options to pass to queryExecute.

execute

boolean

false

true

Run the query immediately after building it.

Example:

SchemaBuilder

schema.drop( "user_logins" );

SQL (MySQL)

DROP TABLE `user_logins`

dropIfExists

Drop a table from the database if it exists.

Argument

Type

Required

Default

Description

table

string

true

The name of the table to drop.

options

struct

false

{}

Options to pass to queryExecute.

execute

boolean

false

true

Run the query immediately after building it.

Example:

SchemaBuilder

schema.dropIfExists( "user_logins" );

SQL (MySQL)

DROP TABLE IF EXISTS `user_logins`
Alter