I am using the Schema module (7.x-1.2) on Drupal 7.34. This is the code I am using for a module I created.
function myid_schema(){ $schema = array(); $schema['myid_templates'] = array( 'description' => 'TODO: please describe this table!', 'fields' => array( 'template_id' => array( 'description' => 'TODO: please describe this field!', 'type' => 'serial', 'not null' => TRUE, ), 'template_name' => array( 'description' => 'TODO: please describe this field!', 'type' => 'varchar', 'not null' => FALSE, ), 'portrait' => array( 'description' => 'TODO: please describe this field!', 'type' => 'boolean', 'not null' => TRUE, ), 'template_width' => array( 'description' => 'TODO: please describe this field!', 'type' => 'numeric', 'not null' => TRUE, 'default' => 0, 'precision' => 0, 'scale' => 0, ), 'template_height' => array( 'description' => 'TODO: please describe this field!', 'type' => 'numeric', 'not null' => TRUE, 'default' => 0, 'precision' => 0, 'scale' => 0, ), ), 'primary key' => array('template_id'), ); return $schema; } function myid_install() { drupal_install_schema('myid_templates'); } After installing the module, it throws this error.
Notice: Undefined index: boolean:normal in DatabaseSchema_pgsql->processField() (line 229 of C:\xampp\htdocs\drupal-7.34\includes\database\pgsql\schema.inc).
PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "NOT" LINE 4: portrait NOT NULL, ^: CREATE TABLE {myid_templates} ( template_id serial, template_name varchar NULL, portrait NOT NULL, template_width numeric(0, 0) NOT NULL default 0, template_height numeric(0, 0) NOT NULL default 0, PRIMARY KEY (template_id) ); Array ( ) in db_create_table() (line 2720 of C:\xampp\htdocs\drupal-7.34\includes\database\database.inc)
Why does it throw an error? How do I fix it?