‪TYPO3CMS  10.4
TYPO3\CMS\Core\Database\Schema\SchemaMigrator Class Reference

Public Member Functions

array[] getUpdateSuggestions (array $statements, bool $remove=false)
 
SchemaDiff[] getSchemaDiffs (array $statements)
 
array migrate (array $statements, array $selectedStatements)
 
array[] install (array $statements, bool $createOnly=false)
 
array importStaticData (array $statements, bool $truncate=false)
 
Table[] parseCreateTableStatements (array $statements)
 

Protected Attributes

Schema[] $schema = array( )
 

Detailed Description

Helper methods to handle SQL files and transform them into individual statements for further processing.

Definition at line 35 of file SchemaMigrator.php.

Member Function Documentation

◆ getSchemaDiffs()

SchemaDiff [] TYPO3\CMS\Core\Database\Schema\SchemaMigrator::getSchemaDiffs ( array  $statements)

Return the raw Doctrine SchemaDiff objects for each connection. This diff contains all changes without any pre-processing.

Parameters
array$statements
Returns
‪SchemaDiff[]
Exceptions

Definition at line 88 of file SchemaMigrator.php.

References TYPO3\CMS\Core\Database\Schema\ConnectionMigrator\create(), and TYPO3\CMS\Core\Database\Schema\SchemaMigrator\parseCreateTableStatements().

◆ getUpdateSuggestions()

array [] TYPO3\CMS\Core\Database\Schema\SchemaMigrator::getUpdateSuggestions ( array  $statements,
bool  $remove = false 
)

Compare current and expected schema definitions and provide updates suggestions in the form of SQL statements.

Parameters
string[]$statements‪The CREATE TABLE statements
bool$remove‪TRUE for RENAME/DROP table and column suggestions, FALSE for ADD/CHANGE suggestions
Returns
‪array[] SQL statements to migrate the database to the expected schema, indexed by performed operation
Exceptions

Definition at line 55 of file SchemaMigrator.php.

References TYPO3\CMS\Core\Database\Schema\ConnectionMigrator\create(), and TYPO3\CMS\Core\Database\Schema\SchemaMigrator\parseCreateTableStatements().

Referenced by TYPO3\CMS\Core\Database\Schema\SchemaMigrator\migrate().

◆ importStaticData()

array TYPO3\CMS\Core\Database\Schema\SchemaMigrator::importStaticData ( array  $statements,
bool  $truncate = false 
)

Import static data (INSERT statements)

Parameters
array$statements
bool$truncate
Returns
‪array

Definition at line 191 of file SchemaMigrator.php.

◆ install()

array [] TYPO3\CMS\Core\Database\Schema\SchemaMigrator::install ( array  $statements,
bool  $createOnly = false 
)

Perform add/change/create operations on tables and fields in an optimized, non-interactive, mode using the original doctrine SchemaManager ->toSaveSql() method.

Parameters
string[]$statements‪The CREATE TABLE statements
bool$createOnly‪Only perform changes that add fields or create tables
Returns
‪array[] Error messages for statements that occurred during the installation procedure.
Exceptions

Definition at line 165 of file SchemaMigrator.php.

References TYPO3\CMS\Core\Database\Schema\ConnectionMigrator\create(), and TYPO3\CMS\Core\Database\Schema\SchemaMigrator\parseCreateTableStatements().

◆ migrate()

array TYPO3\CMS\Core\Database\Schema\SchemaMigrator::migrate ( array  $statements,
array  $selectedStatements 
)

This method executes statements from the update suggestions, or a subset of them filtered by the statements hashes, one by one.

Parameters
string[]$statements‪The CREATE TABLE statements
string[]$selectedStatements‪The hashes of the update suggestions to execute
Returns
‪array
Exceptions

Definition at line 120 of file SchemaMigrator.php.

References TYPO3\CMS\Core\Database\Schema\SchemaMigrator\getUpdateSuggestions().

◆ parseCreateTableStatements()

Table [] TYPO3\CMS\Core\Database\Schema\SchemaMigrator::parseCreateTableStatements ( array  $statements)

Parse CREATE TABLE statements into Doctrine Table objects.

Parameters
string[]$statements‪The SQL CREATE TABLE statements
Returns
‪Table[]
Exceptions

Definition at line 241 of file SchemaMigrator.php.

Referenced by TYPO3\CMS\Core\Database\Schema\SchemaMigrator\getSchemaDiffs(), TYPO3\CMS\Core\Database\Schema\SchemaMigrator\getUpdateSuggestions(), and TYPO3\CMS\Core\Database\Schema\SchemaMigrator\install().

Member Data Documentation

◆ $schema

Schema [] TYPO3\CMS\Core\Database\Schema\SchemaMigrator::$schema = array( )
protected

Definition at line 39 of file SchemaMigrator.php.