Importer
in package
Class that imports structure and data to database.
Table of Contents
- $dieOnError : bool
- Stop import if an error occurs.
- $logs : string
- End of line character.
- $path : string
- Path to the directory with files to import.
- $redundantTables : bool
- Check redundant tables.
- $importers : array<string|int, Base>
- Array with objects to import.
- $startTime : string|float
- Start time.
- __construct() : mixed
- Construct.
- addData() : mixed
- Creating rows.
- addForeignKey() : mixed
- Creates a SQL command for adding a foreign key constraint to an existing table.
- addTables() : mixed
- Creating tables.
- checkIntegrity() : void
- Builds a SQL command for enabling or disabling integrity check.
- drop() : mixed
- Drop tables and columns.
- dropColumns() : mixed
- Drop columns.
- dropForeignKeys() : mixed
- Drop foreign keys.
- dropIndexes() : mixed
- Drop indexes.
- dropTable() : mixed
- Drop table.
- getColumns() : array<string|int, mixed>
- Get columns to create.
- getIndexes() : array<string|int, mixed>
- Get index to create.
- getOptions() : string
- Get additional SQL fragment that will be appended to the generated SQL.
- importData() : mixed
- Import database rows.
- importScheme() : mixed
- Import database structure.
- loadFiles() : mixed
- Load all files for import.
- logs() : mixed
- Show or save logs.
- postImport() : mixed
- Post Process action.
- postUpdate() : mixed
- Post Process action.
- refreshSchema() : mixed
- Refresh db schema.
- renameColumns() : mixed
- Rename columns.
- renameTables() : mixed
- Rename tables.
- updateForeignKey() : mixed
- Update a foreign key constraint to an existing table.
- updateScheme() : mixed
- Update db scheme.
- updateTables() : mixed
- Update tables structure.
- compareColumns() : bool
- Compare two columns if they are identical.
Properties
$dieOnError
Stop import if an error occurs.
public
bool
$dieOnError
= false
$logs
End of line character.
public
string
$logs
$path
Path to the directory with files to import.
public
string
$path
= 'install/install_schema'
$redundantTables
Check redundant tables.
public
bool
$redundantTables
= false
$importers
Array with objects to import.
private
array<string|int, Base>
$importers
= []
$startTime
Start time.
private
string|float
$startTime
Methods
__construct()
Construct.
public
__construct() : mixed
Return values
mixed —addData()
Creating rows.
public
addData(Base $importer) : mixed
Parameters
- $importer : Base
Return values
mixed —addForeignKey()
Creates a SQL command for adding a foreign key constraint to an existing table.
public
addForeignKey(Base $importer) : mixed
Parameters
- $importer : Base
Return values
mixed —addTables()
Creating tables.
public
addTables(Base $importer) : mixed
Parameters
- $importer : Base
Return values
mixed —checkIntegrity()
Builds a SQL command for enabling or disabling integrity check.
public
checkIntegrity(bool $check) : void
Parameters
- $check : bool
-
whether to turn on or off the integrity check.
Return values
void —drop()
Drop tables and columns.
public
drop(Base $importer) : mixed
Parameters
- $importer : Base
Return values
mixed —dropColumns()
Drop columns.
public
dropColumns(array<string|int, mixed> $columns) : mixed
$columns = [ ['TableName', 'columnName'], ['vtiger_smsnotifier', 'status'], ];
Parameters
- $columns : array<string|int, mixed>
Return values
mixed —dropForeignKeys()
Drop foreign keys.
public
dropForeignKeys(array<string|int, mixed> $foreignKeys) : mixed
Parameters
- $foreignKeys : array<string|int, mixed>
-
[$foreignKey=>table,...]
Return values
mixed —dropIndexes()
Drop indexes.
public
dropIndexes(array<string|int, mixed> $tables) : mixed
Parameters
- $tables : array<string|int, mixed>
-
[$table=>[$index,...],...]
Return values
mixed —dropTable()
Drop table.
public
dropTable(array<string|int, mixed>|string $tables) : mixed
Parameters
- $tables : array<string|int, mixed>|string
Return values
mixed —getColumns()
Get columns to create.
public
getColumns(Base $importer, array<string|int, mixed> $table) : array<string|int, mixed>
Parameters
- $importer : Base
- $table : array<string|int, mixed>
Return values
array<string|int, mixed> —getIndexes()
Get index to create.
public
getIndexes(Base $importer, array<string|int, mixed> $table) : array<string|int, mixed>
Parameters
- $importer : Base
- $table : array<string|int, mixed>
Return values
array<string|int, mixed> —getOptions()
Get additional SQL fragment that will be appended to the generated SQL.
public
getOptions(Base $importer, array<string|int, mixed> $table) : string
Parameters
- $importer : Base
- $table : array<string|int, mixed>
Return values
string —importData()
Import database rows.
public
importData() : mixed
Return values
mixed —importScheme()
Import database structure.
public
importScheme() : mixed
Return values
mixed —loadFiles()
Load all files for import.
public
loadFiles([bool|string $path = false ]) : mixed
Parameters
- $path : bool|string = false
Return values
mixed —logs()
Show or save logs.
public
logs([bool $show = true ]) : mixed
Parameters
- $show : bool = true
Return values
mixed —postImport()
Post Process action.
public
postImport() : mixed
Return values
mixed —postUpdate()
Post Process action.
public
postUpdate() : mixed
Return values
mixed —refreshSchema()
Refresh db schema.
public
refreshSchema() : mixed
Return values
mixed —renameColumns()
Rename columns.
public
renameColumns(array<string|int, mixed> $columns) : mixed
$columns = [ ['TableName', 'oldName', 'newName'], ['vtiger_smsnotifier', 'status', 'smsnotifier_status'], ];
Parameters
- $columns : array<string|int, mixed>
Return values
mixed —renameTables()
Rename tables.
public
renameTables(array<string|int, mixed> $tables) : mixed
$tables = [ ['oldName', 'newName'] ['u_#_mail_address_boock', 'u#__mail_address_book'] ];
Parameters
- $tables : array<string|int, mixed>
Return values
mixed —updateForeignKey()
Update a foreign key constraint to an existing table.
public
updateForeignKey(Base $importer) : mixed
Parameters
- $importer : Base
Return values
mixed —updateScheme()
Update db scheme.
public
updateScheme() : mixed
Return values
mixed —updateTables()
Update tables structure.
public
updateTables(Base $importer) : mixed
Parameters
- $importer : Base
Tags
Return values
mixed —compareColumns()
Compare two columns if they are identical.
protected
compareColumns(QueryBuilder $queryBuilder, ColumnSchema $baseColumn, ColumnSchemaBuilder $targetColumn) : bool
Parameters
- $queryBuilder : QueryBuilder
- $baseColumn : ColumnSchema
- $targetColumn : ColumnSchemaBuilder