Table Class

Aurora\Database\Schema Namespace


Properties

name

Table name

protected $name: string

columns

Columns array

protected $columns = []: array

keys

Keys array

protected $keys = []: array

Constructor

__construct

Constructor

Parameters

  • mixed $name — Table name

Signature

public function __construct(mixed $name)

Methods

__construct

Constructor

Parameters

  • mixed $name — Table name

Signature

public function __construct(mixed $name)

name

Set table name

Parameters

  • string $name — Table name

Return Value

  • $this

Signature

public function name(string $name)

getName

Get table name

Return Value

  • string

Signature

public function getName(): string

getColumns

Get columns array

Return Value

  • array

Signature

public function getColumns(): array

getKeys

Get keys array

Return Value

  • array

Signature

public function getKeys(): array

column

Add a new column

Parameters

  • string $name — Column name
  • string $type — Column type

Return Value

  • \Column

Signature

public function column(string $name, string $type): Aurora\Database\Schema\Column

key

Add a new key

Parameters

  • string $name — Key name
  • string $type — Key type

Return Value

  • \Key

Signature

public function key(string $name, string $type): Aurora\Database\Schema\Key

bigInteger

Add a BIGINT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function bigInteger(string $name): Aurora\Database\Schema\Column

binary

Add a BINARY or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function binary(string $name): Aurora\Database\Schema\Column

boolean

Add a BOOLEAN or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function boolean(string $name): Aurora\Database\Schema\Column

char

Add a CHAR or equivalent column

Parameters

  • string $name — Column name
  • int $length — Column length

Return Value

  • \Column

Signature

public function char(string $name, int $length = 100): Aurora\Database\Schema\Column

date

Add a DATE or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function date(string $name): Aurora\Database\Schema\Column

datetime

Add a DATETIME or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function datetime(string $name): Aurora\Database\Schema\Column

decimal

Add a DECIMAL or equivalent column

Parameters

  • string $name — Column name
  • int $precision — Number of significant digits
  • int $scale — Number of digits after the decimal point

Return Value

  • \Column

Signature

public function decimal(string $name, int $precision = 5, int $scale = 2): Aurora\Database\Schema\Column

double

Add a DOUBLE or equivalent column

Parameters

  • string $name — Column name
  • int $precision — Number of significant digits

Return Value

  • \Column

Signature

public function double(string $name, int $precision = 15): Aurora\Database\Schema\Column

enum

Add an ENUM or equivalent column

Parameters

  • string $name — Column name
  • array $options — Options for the enum

Return Value

  • \Column

Signature

public function enum(string $name, array $options = []): Aurora\Database\Schema\Column

float

Add a FLOAT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function float(string $name): Aurora\Database\Schema\Column

integer

Add an INT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function integer(string $name): Aurora\Database\Schema\Column

json

Add a JSON or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function json(string $name): Aurora\Database\Schema\Column

longText

Add a LONGTEXT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function longText(string $name): Aurora\Database\Schema\Column

mediumInteger

Add a MEDIUMINT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function mediumInteger(string $name): Aurora\Database\Schema\Column

mediumText

Add a MEDIUMTEXT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function mediumText(string $name): Aurora\Database\Schema\Column

smallInteger

Add a SMALLINT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function smallInteger(string $name): Aurora\Database\Schema\Column

tinyInteger

Add a TINYINT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function tinyInteger(string $name): Aurora\Database\Schema\Column

string

Add a STRING or equivalent column

Parameters

  • string $name — Column name
  • int $length — Column length

Return Value

  • \Column

Signature

public function string(string $name, int $length = 100): Aurora\Database\Schema\Column

text

Add a TEXT or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function text(string $name): Aurora\Database\Schema\Column

time

Add a TIME or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function time(string $name): Aurora\Database\Schema\Column

timestamp

Add a TIMESTAMP or equivalent column

Parameters

  • string $name — Column name

Return Value

  • \Column

Signature

public function timestamp(string $name): Aurora\Database\Schema\Column

index

Add an INDEX or equivalent key

Parameters

  • string $name — Key name
  • mixed $columns — Key columns

Return Value

  • \Key

Signature

public function index(string $name, mixed $columns = []): Aurora\Database\Schema\Key

primary

Add a PRIMARY or equivalent key

Parameters

  • string $name — Key name
  • mixed $columns — Key columns

Return Value

  • \Key

Signature

public function primary(string $name, mixed $columns = []): Aurora\Database\Schema\Key

unique

Add a UNIQUE or equivalent key

Parameters

  • string $name — Key name
  • mixed $columns — Key columns

Return Value

  • \Key

Signature

public function unique(string $name, mixed $columns = []): Aurora\Database\Schema\Key

foreign

Add a FOREIGN or equivalent key

Parameters

  • string $name — Key name
  • mixed $columns — Key columns

Return Value

  • \Key

Signature

public function foreign(string $name, mixed $columns = []): Aurora\Database\Schema\Key

renameColumn

Rename a column

Parameters

  • string $from — From name
  • string $to — To name

Return Value

  • $this

Signature

public function renameColumn(string $from, string $to)

dropColumn

Delete a column

Parameters

  • string $name — Column name

Return Value

  • $this

Signature

public function dropColumn(string $name)

dropKey

Delete a key

Parameters

  • string $name — Key name

Return Value

  • $this

Signature

public function dropKey(string $name)

dropIndex

Delete an INDEX key

Parameters

  • string $name — Key name

Return Value

  • $this

Signature

public function dropIndex(string $name)

dropPrimary

Delete a PRIMARY key

Parameters

  • string $name — Key name

Return Value

  • $this

Signature

public function dropPrimary(string $name)

dropUnique

Delete an UNIQUE key

Parameters

  • string $name — Key name

Return Value

  • $this

Signature

public function dropUnique(string $name)

dropForeign

Delete an FOREIGN key

Parameters

  • string $name — Key name

Return Value

  • $this

Signature

public function dropForeign(string $name)

Go to top