API - XOOPS 2.5.11 Beta 2
By monxoops.fr
Migrate Class Reference

Public Member Functions

 __construct ($dirname)
 
 saveCurrentSchema ()
 
 getCurrentSchema ()
 
 getTargetDefinitions ()
 
 synchronizeSchema ($force=true)
 
 getSynchronizeDDL ()
 
 getLastError ()
 
 getLastErrNo ()
 

Protected Member Functions

 preSyncActions ()
 
 addMissingTable ($tableName)
 
 synchronizeTable ($tableName)
 
 targetHasColumn ($tableName, $columnName)
 
 targetHasTable ($tableName)
 

Protected Attributes

 $helper
 
 $moduleTables
 
 $tableHandler
 
 $tableDefinitionFile
 
 $targetDefinitions
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $dirname)

Migrate constructor

Parameters
string$dirnamemodule directory name that defines the tables to be migrated
Exceptions

InvalidArgumentException

Exceptions

RuntimeException

Here is the call graph for this function:

Member Function Documentation

◆ addMissingTable()

addMissingTable (   $tableName)
protected

Add table create DDL to the work queue

Parameters
string$tableNametable to add
Returns
void
Here is the caller graph for this function:

◆ getCurrentSchema()

getCurrentSchema ( )

get the current definitions

Returns
array
Here is the caller graph for this function:

◆ getLastErrNo()

getLastErrNo ( )

Return code from last error encountered

Returns
int last error number

◆ getLastError()

getLastError ( )

Return message from last error encountered

Returns
string last error message

◆ getSynchronizeDDL()

getSynchronizeDDL ( )

Compare target and current schema, building work queue in $this->migrate to synchronized

Returns
string[] array of DDL/SQL statements to transform current to target schema
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTargetDefinitions()

getTargetDefinitions ( )

Return the target database condition

Returns
array|bool table structure or false on error
Exceptions

RuntimeException

Here is the caller graph for this function:

◆ preSyncActions()

preSyncActions ( )
protected

Perform any upfront actions before synchronizing the schema.

The schema comparison cannot recognize changes such as renamed columns or renamed tables. By overriding this method, an implementation can provide the logic to accomplish these types of changes, and leave the other details to be handled by synchronizeSchema().

An suitable implementation should be provided by a module by extending Migrate to define any required actions.

Some typical uses include:

  • table and column renames
  • data conversions
  • move column data
Returns
void
Here is the caller graph for this function:

◆ saveCurrentSchema()

saveCurrentSchema ( )

Save current table definitions to a file

This is intended for developer use when setting up the migration by using the current database state

Here is the call graph for this function:

◆ synchronizeSchema()

synchronizeSchema (   $force = true)

Execute synchronization to transform current schema to target

Parameters
bool$forcetrue to force updates even if this is a 'GET' request
Returns
bool true if no errors, false if errors encountered
Here is the call graph for this function:

◆ synchronizeTable()

synchronizeTable (   $tableName)
protected

Build any DDL required to synchronize an existing table to match the target schema

Parameters
string$tableNametable to synchronize
Returns
void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ targetHasColumn()

targetHasColumn (   $tableName,
  $columnName 
)
protected

determine if a column on a table exists in the target definitions

Parameters
string$tableNametable containing the column
string$columnNamecolumn to check
Returns
bool true if table and column combination is defined, otherwise false
Here is the caller graph for this function:

◆ targetHasTable()

targetHasTable (   $tableName)
protected

determine if a table exists in the target definitions

Parameters
string$tableNametable containing the column
Returns
bool true if table is defined, otherwise false

Field Documentation

◆ $helper

$helper
protected

◆ $moduleTables

$moduleTables
protected

◆ $tableDefinitionFile

$tableDefinitionFile
protected

◆ $tableHandler

$tableHandler
protected

◆ $targetDefinitions

$targetDefinitions
protected

The documentation for this class was generated from the following file: