Function DatabaseConnector->alter_table_field
Definitions
sources/database.php
- Change the type of a DB field in a table.Note: this function cannot change the keys in the database on its own (use change_primary_key for that), although you should include * if something will be a key.Note: this function does not support ascension/descension of translatability, use promote_text_field_to_comcode for that.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: bool
Parameters
Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
---|---|---|---|---|---|---|---|
$table_name | ID_TEXT | No | No | required parameter | N/A | N/A | The table name |
$name | ID_TEXT | No | No | required parameter | N/A | N/A | The field name |
$type | ID_TEXT | No | No | required parameter | N/A | N/A | The new field type |
$new_name | ?ID_TEXT | No | No | Null | N/A | N/A | The new field name (null: leave name) |
Returns
- Whether we failed to set an auto-increment
- Type: boolean
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Change the type of a DB field in a table.Note: this function cannot change the keys in the database on its own (use change_primary_key for that), although you should include * if something will be a key.Note: this function does not support ascension/descension of translatability, use promote_text_field_to_comcode for that.
*
* @param ID_TEXT $table_name The table name
* @param ID_TEXT $name The field name
* @param ID_TEXT $type The new field type
* @param ?ID_TEXT $new_name The new field name (null: leave name)
* @return boolean Whether we failed to set an auto-increment
*/
public function alter_table_field(string $table_name, string $name, string $type, ?string $new_name = null) : bool
* Change the type of a DB field in a table.Note: this function cannot change the keys in the database on its own (use change_primary_key for that), although you should include * if something will be a key.Note: this function does not support ascension/descension of translatability, use promote_text_field_to_comcode for that.
*
* @param ID_TEXT $table_name The table name
* @param ID_TEXT $name The field name
* @param ID_TEXT $type The new field type
* @param ?ID_TEXT $new_name The new field name (null: leave name)
* @return boolean Whether we failed to set an auto-increment
*/
public function alter_table_field(string $table_name, string $name, string $type, ?string $new_name = null) : bool