I want to build a installable module. Let's assume the module name will be bluedog_calculator
. I have already created other required files like bluedog_calculator.info
and bluedog_calculator.module
. Now I am trying to use hook_schema()
and whenever i am trying to use drush dre bluedog_calculator -y
, Konsole gives me an error as follows:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; [error] check the manual that corresponds to your MariaDB server version for the right syntax to use near 'unsigned NOT NULL COMMENT
.
I am not sure what is the right syntax for applying this hook.
My code is
function bluedog_calculator_schema(){
$schema['bluedog_calculator_machine'] = array(
'description' => 'TODO: please describe this table!',
'fields' => array(
'id' => array(
'description' => 'TODO: please describe this field!',
'type' => 'serial',
'not null' => TRUE,
),
'name' => array(
'description' => 'TODO: please describe this field!',
'type' => 'varchar',
'length' => '100',
'not null' => TRUE,
),
'speed' => array(
'description' => 'TODO: please describe this field!',
'type' => 'float',
'not null' => TRUE,
),
'cost' => array(
'description' => 'TODO: please describe this field!',
'type' => 'float',
'not null' => TRUE,
),
'image' => array(
'description' => 'TODO: please describe this field!',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'web_link' => array(
'description' => 'TODO: please describe this field!',
'type' => 'text',
'unsigned' => TRUE,
'not null' => TRUE,
),
'is_default' => array(
'description' => 'TODO: please describe this field!',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array('id'),
);
return $schema;
}