PHP Class FromMySqlToPostgreSql, FromMySqlToPostgreSql

Author: Anatoly Khaytovich
ファイルを表示 Open project: AnatolyUss/FromMySqlToPostgreSql Class Usage Examples

Public Methods

Method Description
__construct ( array $arrConfig ) Constructor.
__destruct ( ) Destructor.
migrate ( ) : void Performs migration from source database to destination database.

Private Methods

Method Description
arrangeColumnsData ( array $arrColumns ) : string Arranges columns data before loading.
connect ( ) : void Check if both servers are connected.
createAndPopulateTables ( ) : boolean Create tables with the basic structure (column names and data types).
createConstraints ( ) Set table constraints.
createForeignKeysAndRunVacuumFullAndAnalyze ( ) Set foreign key constraints, then run "vacuum full" and "ANALYZE" for each table.
createSchema ( ) : boolean Create a new database schema.
createSequence ( string $strTableName, array $arrColumns ) : void Define which column in given table has the "auto_increment" attribute.
createTable ( string $strTableName ) : boolean Migrate structure of a single table to PostgreSql server.
createView ( string $strViewName ) : void Migrate given view to PostgreSql server.
createViews ( ) Attempt to create views.
extractDbName ( string $strConString ) : string Extract database name from given query-string.
generateError ( PDOException $e, string $strMessage, string $strSql = '' ) : void Writes a ditailed error message to the log file, if specified.
generateReport ( ) : string Generates a summary report.
loadStructureToMigrate ( ) : boolean Load MySql tables, that need to be migrated into an array.
log ( string $strLog, boolean $boolIsError = false ) : void Outputs given log.
populateTable ( string $strTableName ) : integer Populate current table.
populateTableWorker ( string $strTableName, string $strSelectFieldList, integer $intOffset, integer $intRowsInChunk, integer $intRowsCnt, integer $intForNowInserted ) : integer Load a chunk of data using "PostgreSql COPY".
processComment ( string $strTableName, array $arrColumns ) : void Create comments.
processDefault ( string $strTableName, array $arrColumns ) : void Define which columns of the given table have default value.
processEnum ( string $strTableName, array $arrColumns ) : void Define which columns of the given table are of type "enum".
processForeignKey ( string $strTableName ) : void Create foreign keys.
processIndexAndKey ( string $strTableName, array $arrColumns ) : void Create primary key and indices.
processNull ( string $strTableName, array $arrColumns ) : void Define which columns of the given table can contain the "NULL" value.
runVacuumFullAndAnalyze ( string $strTableName ) : void Runs "vacuum full" and "ANALYZE" for given table.
setTableConstraints ( string $strTableName ) : boolean Set constraints (excluding foreign key constraints) for given table.

Method Details

__construct() public method

Constructor.
public __construct ( array $arrConfig )
$arrConfig array

__destruct() public method

Destructor.
public __destruct ( )

migrate() public method

Performs migration from source database to destination database.
public migrate ( ) : void
return void