I have an entity whose field schema is already defined and now I am trying to add couple of fields to it.
But I am not sure how to code it up using schema_alter.Below is an example on how I would code the schema for the field using hook_field_schema().
function hook_field_schema($field){
$columns = array();
if($field['type'] == 'some_field_name'){
$columns = array(
'col1'=>array(
'type =>'text'
'size' => 'big'
'not null' => false),
'col2'=>array(
'type =>'text'
'size' => 'big'
'not null' => false),
);
}
//Similar for other fields
}
Confusion is on how to decompose this schema according to schema_alter.
I am following this article to implement hook_field_schema_alter()
Edit: I am using an update function to create the field (field_create_instance
), since this is an already an existing module and I do not want to disable it and enabled it again.