I have a module which behaves much like question and answers. Each question needs to have a help image. So far, I have written the schema as this:
function mymodule_schema() {
$schema(mymodule_questions) = array(
'description' => 'Stores questions for my module',
'fields' => array(
'qid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Question ID.'
),
'prompt' => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'normal',
'description' => 'Question prompt',
'length' => '1000'
),
'option_type' => array(
'type' => 'varchar',
'not null' => TRUE,
'description' => 'Option Type',
'length' => '255'
),
/* Image field schema goes here */
),
);
}
?>
Now, I want to add an image field, i.e. a field where admins can upload images to be shown with each question. What should be the schema for this field? Should I use the Field API in the schema (is that possible?)? If yes, how?
Thanks.
Kaustav Das Modak