Documentation

CRM_Extension_Upgrader_SchemaTrait

The SchemaTrait provides utilities for altering tables during an upgrade.

Table of Contents

Methods

addColumn()  : bool
Add a column to a table if it doesn't already exist
addIndex()  : bool
Add an index to one or more columns.
dropColumn()  : bool
Drop a column from a table if it exists.
dropIndex()  : bool
Drop index from a table if it exists.

Methods

addColumn()

Add a column to a table if it doesn't already exist

public static addColumn(string $table, string $column, string $properties) : bool
Parameters
$table : string
$column : string
$properties : string
Return values
bool

addIndex()

Add an index to one or more columns.

public static addIndex(string $table, string|array<string|int, mixed> $columns[, string $prefix = 'index' ]) : bool
Parameters
$table : string
$columns : string|array<string|int, mixed>
$prefix : string = 'index'
Return values
bool

dropColumn()

Drop a column from a table if it exists.

public static dropColumn(string $table, string $column) : bool
Parameters
$table : string
$column : string
Return values
bool

dropIndex()

Drop index from a table if it exists.

public static dropIndex(string $table, string $indexName) : bool
Parameters
$table : string
$indexName : string
Return values
bool

        
On this page

Search results