smf_db_change_column

Description

Changes a column

Syntax

bool smf_db_change_column (string $table_name, string $old_column, array $column_info[, array $parameters[, string $error]])



Parameter $table_name

Expected type: String
Description: The name of the table containing the column we want to change



Parameter $old_column

Expected type: String
Description: The name of the column we want to change



Parameter $column_info

Expected type: Array
Description: Information about the changes we want to make to the column (at least one of these must be set)

Array Elements of $column_info
Key Optional Expected type Description
auto yes Boolean True to make the column auto-incrementing, false to remove the auto increment
default yes Mixed The default value for the column
name yes String The new name for the column
null yes Boolean Whether or not to allow null values (set to false to change a column to NOT NULL)
size yes Integer Size of the column
type yes Enumerated String Datatype for the column (see smf_db_add_column for possible values)



Parameter $parameters

Expected type: Array
Description: An array of parameters

Array Elements of $parameters
Key Optional Expected type Description
no_prefix yes Boolean If true, SMF won't add the db_prefix to the table name



Parameter $error

Expected type: Enumerated String
Description: Error parameter (currently unused?)

Possible string values
Allowed values Description
'fatal' Default value



Return value

Expected type: Boolean
Description: True if the changes were successful, false if the column doesn't exist


Notes

  • All items in the column_info parameter are optional, but at lest one must be set
  • Assumes you've already taken care of any necessary updates (such as updating NULL values before changing a column to NOT NULL)
Advertisement: