class Illuminate / Database / Schema / Builder
You are viewing an older version of the documentation. For the latest, please visit master documentation.

Builder

Properties

protected

$connection Connection

The database connection instance.

Default: null
protected

$grammar Grammar

The schema grammar instance.

Default: null
protected

$resolver Closure

The Blueprint resolver callback.

Default: null
public static

$defaultStringLength int

The default string length for migrations.

Default: 255
public static

$defaultMorphKeyType string

The default relationship morph key type.

Default: 'int'

Methods

public

__construct ( Connection $connection ) : void

Create a new database Schema manager.

Parameters

public static

defaultStringLength ( $length ) : void

Set the default string length for migrations.

Parameters

  • $length int
public static

defaultMorphKeyType ( string $type ) : void

Set the default morph key type for migrations.

Parameters

  • $type string
public static

morphUsingUuids ( ) : void

Set the default morph key type for migrations to UUIDs.

public

createDatabase ( $name ) : bool

Create a database in the schema.

Parameters

  • $name string
public

dropDatabaseIfExists ( $name ) : bool

Drop a database from the schema if the database exists.

Parameters

  • $name string
public

hasTable ( $table ) : bool

Determine if the given table exists.

Parameters

  • $table string
public

hasColumn ( $table , $column ) : bool

Determine if the given table has a given column.

Parameters

  • $table string
  • $column string
public

hasColumns ( $table , array $columns ) : bool

Determine if the given table has given columns.

Parameters

  • $table string
  • $columns array
public

getColumnType ( $table , $column ) : string

Get the data type for the given column name.

Parameters

  • $table string
  • $column string
public

getColumnListing ( $table ) : array

Get the column listing for a given table.

Parameters

  • $table string
public

table ( $table , Closure $callback ) : void

Modify a table on the schema.

Parameters

public

create ( $table , Closure $callback ) : void

Create a new table on the schema.

Parameters

public

drop ( $table ) : void

Drop a table from the schema.

Parameters

  • $table string
public

dropIfExists ( $table ) : void

Drop a table from the schema if it exists.

Parameters

  • $table string
public

dropColumns ( $table , $columns ) : void

Drop columns from a table schema.

Parameters

  • $table string
  • $columns string|array
public

dropAllTables ( ) : void

Drop all tables from the database.

public

dropAllViews ( ) : void

Drop all views from the database.

public

dropAllTypes ( ) : void

Drop all types from the database.

public

getAllTables ( ) : void

Get all of the table names for the database.

public

rename ( $from , $to ) : void

Rename a table on the schema.

Parameters

  • $from string
  • $to string
public

enableForeignKeyConstraints ( ) : bool

Enable foreign key constraints.

public

disableForeignKeyConstraints ( ) : bool

Disable foreign key constraints.

protected

build ( Blueprint $blueprint ) : void

Execute the blueprint to build / modify the table.

Parameters

protected

createBlueprint ( $table , Closure $callback ) : Blueprint

Create a new command set with a Closure.

Parameters

public

registerCustomDoctrineType ( $class , $name , $type ) : void

Register a custom Doctrine mapping type.

Parameters

  • $class string
  • $name string
  • $type string
public

getConnection ( ) : Connection

Get the database connection instance.

public

setConnection ( Connection $connection ) : $this

Set the database connection instance.

Parameters

public

blueprintResolver ( Closure $resolver ) : void

Set the Schema Blueprint resolver callback.

Parameters