2016-09-21 5 views
0

誰かが私がこれで何かを逃したかどうか教えてくれますか?コードブロックの後ろに記載されているエラーを投げ続けます。Drupal 7更新スキーマを破る

function license_update_7101() { 

    $schema['license_agreements'] = array(
    'description' => 'License User Agreements', 
    'fields' => array(
     'license_id' => array(
     'description' => 'Primary key for license records', 
     'type'  => 'serial', 
     'not null' => TRUE, 
     'unsigned' => TRUE 
    ), 
     'user_id' => array(
     'description' => 'License agreed to by User ID', 
     'type'  => 'int', 
     'not null' => FALSE, 
     'unsigned' => TRUE, 
     'default'  => '0' 
    ), 
     'product_id' => array(
     'description' => 'Product ID that represents the product this agreement was assigned to.', 
     'type'  => 'int', 
     'not null' => FALSE, 
     'unsigned' => TRUE, 
     'default'  => '0' 
    ), 
     'session' => array(
     'description' => 'Session created during account creation.', 
     'type'  => 'varchar', 
     'length'  => 32, 
     'not null' => FALSE, 
     'default'  => '' 
    ), 
     'agreed' => array(
     'description' => 'Represents if the license was agreed to or not', 
     'type'  => 'int', 
     'size'  => 'tiny', 
     'not null' => FALSE, 
     'unsigned' => TRUE, 
     'default'  => '0' 
    ), 
     'agreement_date' => array(
     'description' => 'Date this license was agreed to by user.', 
     'type'  => 'datetime', 
     'mysql_type' => 'DATETIME', 
     'disp-width' => '11', 
     'not null' => FALSE, 
     'default'  => NULL 
    ), 
     'blog_name' => array(
     'description' => 'URL for actual product license belongs to.', 
     'type'  => 'varchar', 
     'length'  => '128', 
     'not null' => FALSE, 
     'default'  => '' 
    ), 
     'primary key' => array('license_id') 
    ) 
); 

    db_create_table('license_agreements', $schema['license_agreements']); 
} 

ERROR:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB [error] 
server version for the right syntax to use near 'DEFAULT NULL 
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'License' at line 9 

本当にこれを解決取得するのが大好きです。

ありがとうございます!

答えて

0

他のデベロッパーを迎えてくれて、私は物事を吹き飛ばしているものを見つけようとしてくれました。

'primary key' => array('license_id') 

私はそれはfields配列内に埋め込まれ、それの後に/外であることを必要としていることに気づいてしまいました。

したがって、その行をlicense_agreements配列の配列要素として移動するだけの簡単な修正が行われました。問題が解決しました!