abstract class Schema

Database schema base class

Properties

protected string $tableName Table name
protected string $storageEngine Db storage engine

Methods

void
create(TableBlueprint $table)

Create table

void
update(TableBlueprint $table)

Update existing table

void
seeds(Seed $seed)

Insert or update rows in table

string
getTableName()

Return table name

static bool|string
getTable(string $class)

Return model table name

void
createTable()

Create table

void
updateTable()

Update table

mixed|false
runSeeds()

Execute seeds

bool
isEmpty()

Return true if table is empty

static QueryBuilder
getQuery(string $tableName)

Get query builder for table

static boolean
setRowFormat(string $table, string $format = 'DYNAMIC')

Changes db table row format

void
build(TableBlueprint $blueprint, Builder $builder)

Execute blueprint.

static bool
hasTable(object|string $model)

Check if database exist.

bool
dropTable(boolean $emptyOnly = true)

Drop table

string
getColumnType(string $columnName)

Get column type

bool
tableExists()

Checkif table exist

boolean
hasColumn(string $column)

Check if table column exists.

bool
hasIndex(string $indexName)

Return true if index exist

static object
schema()

Return shema object

static bool
install(string $class, string|null $extension = null, bool $showErorr = false)

Run Create and Update migration

static bool
unInstall(string $class, string|null $extension = null, bool $force = false)

UnInstall migration

Details

at line 46
abstract void create(TableBlueprint $table)

Create table

Parameters

TableBlueprint $table

Return Value

void

at line 54
abstract void update(TableBlueprint $table)

Update existing table

Parameters

TableBlueprint $table

Return Value

void

at line 62
void seeds(Seed $seed)

Insert or update rows in table

Parameters

Seed $seed

Return Value

void

at line 71
string getTableName()

Return table name

Return Value

string

at line 82
static bool|string getTable(string $class)

Return model table name

Parameters

string $class Model class name

Return Value

bool|string

at line 94
void createTable()

Create table

Return Value

void

at line 116
void updateTable()

Update table

Return Value

void

at line 136
mixed|false runSeeds()

Execute seeds

Return Value

mixed|false

at line 152
bool isEmpty()

Return true if table is empty

Return Value

bool

at line 165
static QueryBuilder getQuery(string $tableName)

Get query builder for table

Parameters

string $tableName

Return Value

QueryBuilder

at line 177
static boolean setRowFormat(string $table, string $format = 'DYNAMIC')

Changes db table row format

Parameters

string $table
string $format

Return Value

boolean

at line 189
void build(TableBlueprint $blueprint, Builder $builder)

Execute blueprint.

Parameters

TableBlueprint $blueprint
Builder $builder

Return Value

void

at line 203
static bool hasTable(object|string $model)

Check if database exist.

Parameters

object|string $model Table name or db model object

Return Value

bool

at line 228
bool dropTable(boolean $emptyOnly = true)

Drop table

Parameters

boolean $emptyOnly

Return Value

bool

at line 246
string getColumnType(string $columnName)

Get column type

Parameters

string $columnName

Return Value

string

at line 256
bool tableExists()

Checkif table exist

Return Value

bool

at line 267
boolean hasColumn(string $column)

Check if table column exists.

Parameters

string $column

Return Value

boolean

at line 278
bool hasIndex(string $indexName)

Return true if index exist

Parameters

string $indexName

Return Value

bool

at line 299
static object schema()

Return shema object

Return Value

object

at line 312
static bool install(string $class, string|null $extension = null, bool $showErorr = false)

Run Create and Update migration

Parameters

string $class
string|null $extension
bool $showErorr

Return Value

bool

at line 355
static bool unInstall(string $class, string|null $extension = null, bool $force = false)

UnInstall migration

Parameters

string $class
string|null $extension
bool $force Set to true will drop table if have rows.

Return Value

bool