CRM_Core_BAO_SchemaHandler
class CRM_Core_BAO_SchemaHandler
This file contains functions for creating and altering CiviCRM-tables structure.
$table = array( 'name' => TABLE_NAME, 'attributes' => ATTRIBUTES, 'fields' => array( array( 'name' => FIELD_NAME, // can be field, index, constraint 'type' => FIELD_SQL_TYPE, 'class' => FIELD_CLASS_TYPE, 'primary' => BOOLEAN, 'required' => BOOLEAN, 'searchable' => TRUE, 'fk_table_name' => FOREIGN_KEY_TABLE_NAME, 'fk_field_name' => FOREIGN_KEY_FIELD_NAME, 'comment' => COMMENT, 'default' => DEFAULT, ) ... ));
Methods
Create a CiviCRM-table
No description
No description
No description
No description
No description
No description
No description
No description
Delete a CiviCRM-table.
No description
No description
Create indexes.
Get indexes for tables
Drop an index if one by that name exists.
No description
Check if the table has an index matching the name.
Check if the table has a specified column.
Check if a foreign key Exists
Remove a foreign key from a table if it exists.
Add index signature hash to DAO file calculation.
Compare the indices specified in the XML files with those in the DB.
Create missing indices.
Build the sql to alter the field.
Get the sql to alter an individual field.
Details
at line 67
static bool
createTable(array $params)
Create a CiviCRM-table
at line 89
static string
buildTableSQL(array $params)
at line 126
static string
buildFieldSQL(array $params, $separator, $prefix)
at line 161
static NULL|string
buildPrimaryKeySQL(array $params, $separator, $prefix)
at line 180
static NULL|string
buildSearchIndexSQL(array $params, $separator, $prefix, bool $indexExist = FALSE)
at line 213
static string
buildIndexSQL(array $params, $separator, $prefix)
at line 245
static bool
changeFKConstraint(string $tableName, string $fkTableName)
at line 273
static NULL|string
buildForeignKeySQL(array $params, $separator, $prefix, string $tableName)
at line 299
static bool
alterFieldSQL(array $params, bool $indexExist = FALSE, bool $triggerRebuild = TRUE)
deprecated
deprecated
at line 333
static
dropTable(string $tableName)
Delete a CiviCRM-table.
at line 345
static
dropColumn(string $tableName, string $columnName, bool $l18n = FALSE, bool $isUpgradeMode = FALSE)
at line 367
static
changeUniqueToIndex(string $tableName, bool $dropUnique = TRUE)
at line 402
static
createIndexes($tables, string $createIndexPrefix = 'index', array $substrLengths = [])
Create indexes.
at line 485
static array('tableName'
getIndexes(array $tables)
Get indexes for tables
at line 509
static
dropIndexIfExists(string $tableName, string $indexName)
Drop an index if one by that name exists.
at line 523
static
alterFieldLength(int $customFieldID, string $tableName, string $columnName, $length)
at line 580
static bool
checkIfIndexExists(string $tableName, array $indexName)
Check if the table has an index matching the name.
at line 601
static bool
checkIfFieldExists(string $tableName, string $columnName, bool $i18nRewrite = TRUE)
Check if the table has a specified column.
at line 614
static bool
checkFKExists(string $table_name, string $constraint_name)
Check if a foreign key Exists
at line 645
static bool
safeRemoveFK($table_name, $constraint_name)
Remove a foreign key from a table if it exists.
at line 659
static
addIndexSignature(string $table, array $indices)
Add index signature hash to DAO file calculation.
at line 677
static array
getMissingIndices(bool $dropFalseIndices = FALSE)
Compare the indices specified in the XML files with those in the DB.
at line 734
static
createMissingIndices(array $missingIndices)
Create missing indices.
at line 761
static string
buildFieldChangeSql(array $params, bool $indexExist)
Build the sql to alter the field.
at line 778
static string
getFieldAlterSQL(array $params, bool $indexExist)
Get the sql to alter an individual field.
This will need to have an ALTER TABLE statement appended but by getting by individual field we can do one or many.