What is wrong with my hook_schema code? I am pulling my hair for the past half of the day trying to figure out what is wrong. Here is my hook_schema function:

&lt;?php

function image_gallery_schema() {
  $schema = array();

  $schema['gallery'] = array(
    'description' =&gt; 'The main store for gallery entity',
    'fields' =&gt; array(
      'id' =&gt; array(
        'description' =&gt; 'Primary key for our table of gallery',
        'type' =&gt; 'serial',
        'unsigned' =&gt; TRUE,
        'not null' =&gt; TRUE,
      ),
      'uid' =&gt; array(
        'description' =&gt; 'User id',
        'type' =&gt; 'int',
        'not null' =&gt; TRUE
      ),
      'title' =&gt; array(
        'description' =&gt; 'Title of the gallery',
        'type' =&gt; 'text',
        'not null' =&gt;TRUE,
       ),
      'created' =&gt; array(
        'description' =&gt; 'Creation time',
        'type' =&gt; 'int',
        'default' =&gt; 0,
        'not null' =&gt; TRUE
      ),
      'changed' =&gt; array(
        'description' =&gt; 'Changed time',
        'type' =&gt; 'int',
        'default' =&gt; 0,
        'not null' =&gt; TRUE
      ),
      'gall_description' =&gt; array(
        'description' =&gt; 'Description of gallery',
        'type' =&gt; 'text',
        'not null' =&gt;TRUE,
       ),
    ),
    'primary key' =&gt; array('id'),
  );

  $schema['photos'] = array(
    'description' =&gt; 'For storing photos',
    'fields' =&gt; array(
      'id' =&gt; array(
        'description' =&gt; 'Primary key for photo',
        'type' =&gt; 'serial',
        'unsigned' =&gt; TRUE,
        'not null' =&gt; TRUE,
      ),
      'g_id' =&gt; array(
        'description' =&gt; 'Gallery id',
        'type' =&gt; 'int',
        'unsigned' =&gt; TRUE,
        'not null' =&gt; TRUE,
      ),
      'full_path' =&gt; array(
        'description' =&gt; 'full photo path',
        'type' =&gt; 'text',
        'unsigned' =&gt; TRUE,
        'not null' =&gt; TRUE,
      ),
      'short_path' =&gt; array(
        'description' =&gt; 'short photo path',
        'type' =&gt; 'text',
        'unsigned' =&gt; TRUE,
        'not null' =&gt; TRUE,
      ),
      'img_description' =&gt; array(
        'description' =&gt; 'Image description',
        'type' =&gt; 'text',
        'unsigned' =&gt; TRUE,
        'not null' =&gt; TRUE,
      ),
    ),
    'primary key' =&gt; array('id'),
    'indexes' =&gt; array(
      'g_id' =&gt; array('g_id'),
    ),
    'foreign keys' =&gt; array(
      'gid' =&gt; array(
        'table' =&gt; 'gallery',
        'columns' =&gt; array('g_id' =&gt; 'id'),
      ),
    ),
  );

  return $schema;
}


I checked all the brackets and everything seems to be in place. It does create gallery table, but fails to create photo table. Error I get:


  Syntax error or access violation: 1064 You have an error in your SQL syntax;


I was trying to see how gallery schema is different from photos but I can't find anything. Maybe something is wrong with indexes and foreign keys? I checked multiple examples and everything seems to be the same. If someone could help me out, I would be more thank thankful.
It must be because you are adding the unsigned attribute to text fields.