Why am I getting this error for the schema I define in my module? I'm building a module for Drupal 7, but I have troubles with my schema, and I don't understand why.

This is my schema.

$schema['table_name'] = array(
        'fields' =&gt; array(
            'id' =&gt; array(
                'type' =&gt; 'serial',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            ),
            'nid' =&gt; array(
                'type' =&gt; 'int',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            ),
            'oid' =&gt; array(
                'type' =&gt; 'int',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            ),
            'start_time' =&gt; array(
                'type' =&gt; 'datetime',
                'not null' =&gt; false
            ),
            'end_time' =&gt; array(
                'type' =&gt; 'datetime',
                'not null' =&gt; false
            ),
            'duration' =&gt; array(
                'type' =&gt; 'int',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            )
        ),
        'primary key' =&gt; array('id'),
        'unique keys' =&gt; array('id')
    );


I get this error.


  PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 
  You have an error in your SQL syntax; check the manual that
  corresponds to  your MySQL server version for the right syntax to use
  near 'NULL DEFAULT NULL,  end_time NULL DEFAULT NULL, duration INT
  unsigned NOT ' at line 5: CREATE  TABLE {table_name} ( id INT
  unsigned NOT NULL auto_increment, nid INT  unsigned NOT NULL, oid
  INT unsigned NOT NULL, start_time NULL DEFAULT  NULL, end_time
  NULL DEFAULT NULL, duration INT unsigned NOT NULL, PRIMARY  KEY
  (id), UNIQUE KEY 0 () ) ENGINE = InnoDB DEFAULT CHARACTER SET
  utf8;  Array ( ) in db_create_table() (line 2717 of
  /Applications/MAMP/htdocs/project/www/includes/database/database.inc).


How can I fix this error?
I've managed to fix it. I've altered 2 things from my original schema, the first issue was that Drupal 7 no longer supports 'type' =&gt; 'datetime', instead use 'mysql_type' =&gt; 'datetime'. The second was 'unique keys' =&gt; array('id'), I removed this and everything works correctly.
Solution...
$schema['table_name'] = array(
        'fields' =&gt; array(
            'id' =&gt; array(
                'type' =&gt; 'serial',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            ),
            'nid' =&gt; array(
                'type' =&gt; 'int',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            ),
            'oid' =&gt; array(
                'type' =&gt; 'int',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            ),
            'start_time' =&gt; array(
                'type' =&gt; 'int',
                'mysql_type' =&gt; 'datetime',
                'size' =&gt; 'normal',
                'not null' =&gt; false
            ),
            'end_time' =&gt; array(
                'type' =&gt; 'int',
                'mysql_type' =&gt; 'datetime',
                'size' =&gt; 'normal',
                'not null' =&gt; false
            ),
            'duration' =&gt; array(
                'type' =&gt; 'int',
                'unsigned' =&gt; true,
                'not null' =&gt; true,
                'length' =&gt; 11
            )
        ),
        'primary key' =&gt; array('id'),
        'mysql_engine' =&gt; 'InnoDB'
    );