\Nano4\DB\UpdateTable

Represents a table with update information.

This should not be constructed manually. It is returned by the Schema::getTable() and Schema::listTables() methods.

Summary

Methods
Properties
Constants
__construct()
get_versions()
update()
versionString()
currentVersion()
latestVersion()
$name
$current
$latest
$need_update
$update_run
$update_ok
$update_err
$update_sql_output
$updateDir
No constants found
get_table_schema()
check_table_updates()
$parent
$db
$conf
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : 

The table name.

Type

$current

$current : 

The table's current schema version.

Type

$latest

$latest : 

The newest schema version for this table.

Type

$need_update

$need_update : 

Should this table be updated?

Type

$update_run

$update_run : 

Was an update performed (or attempted) in this session?

Type

$update_ok

$update_ok : 

Did the update succeed? Only valid if $updated = true.

Type

$update_err

$update_err : 

Any errors encountered when attempting an update.

Type

$update_sql_output

$update_sql_output : 

The output from the SQL portion of the update (if any.)

Type

$updateDir

$updateDir : 

The table update folder.

Type

$parent

$parent : 

Type

$db

$db : 

Type

$conf

$conf : 

Type

Methods

__construct()

__construct(\Nano4\DB\Update\Str  $name, Object  $parent, Object  $db, Array  $opts = array()) 

Build a Nano4\DB\Update\Table object.

You should never have to call this manually, it's called by the Schema class. However, in case you need to override it, the definition is included here.

Parameters

\Nano4\DB\Update\Str $name

The name of the table.

Object $parent

The parent Schema object.

Object $db

The parent database object.

Array $opts

Extra options (reserved for future use.)

get_versions()

get_versions() 

update()

update() : Bool

Perform the updates on the table schema.

Returns

Bool —

It will return true if the update succeeded. It will return false if the update failed.

This method will also change the values of the following properties:

$this->updated Will be set to true if an update is performed. $this->update_ok Will match the return value of this method. $this->update_err Any errors will be appended to this list.

versionString()

versionString(  $num) 

Parameters

$num

currentVersion()

currentVersion() 

latestVersion()

latestVersion() 

get_table_schema()

get_table_schema() 

check_table_updates()

check_table_updates()