Schema Class
Aurora\Database\Schema Namespace
Properties
connection
Connection name
protected $connection = 'default': string
database
Database instance
protected $database: \Database
Constructor
__construct
Constructor
Parameters
Aurora\Database\Database
$database
— Database instance
Signature
public function __construct(Aurora\Database\Database $database)
Methods
__construct
Constructor
Parameters
-
Aurora\Database\Database
$database
— Database instance
Signature
public function __construct(Aurora\Database\Database $database)
setConnection
Set connection name
Parameters
-
string
$connection
— Connection name
Return Value
$this
Signature
public function setConnection(string $connection)
getTables
Get the tables on the current database
Return Value
array
Signature
public function getTables(): array
hasTable
Check if a table exists or not in the current database
Parameters
-
string
$name
— Table name
Return Value
bool
Signature
public function hasTable(string $name): bool
hasColumn
Check if the given table has a specific column
Parameters
-
string
$table
— Table name -
string
$name
— Column name
Return Value
bool
Signature
public function hasColumn(string $table, string $name): bool
hasKey
Check if the given table has a specific key
Parameters
-
string
$table
— Table name -
string
$name
— Key name
Return Value
bool
Signature
public function hasKey(string $table, string $name): bool
create
Create a table
Parameters
-
string
$name
— Table name -
Closure
$callback
— Callback for building the table
Return Value
mixed
Signature
public function create(string $name, Closure $callback)
createIfNotExists
Create a table after asserting that it DOES NOT exist
Parameters
-
string
$name
— Table name -
Closure
$callback
— Callback for building the table
Return Value
mixed
Signature
public function createIfNotExists(string $name, Closure $callback)
drop
Delete a table
Parameters
-
string
$name
— Table name
Return Value
mixed
Signature
public function drop(string $name)
dropIfExists
Delete a table after asserting that it DOES exist
Parameters
-
string
$name
— Table name
Return Value
mixed
Signature
public function dropIfExists(string $name)
table
Modify a table
Parameters
-
string
$name
— Table name -
Closure
$callback
— Callback for modifying the table
Return Value
mixed
Signature
public function table(string $name, Closure $callback)
rename
Rename a table
Parameters
-
string
$from
— From name -
string
$to
— To name
Return Value
mixed
Signature
public function rename(string $from, string $to)