2016-09-21 3 views
0

Может ли кто-нибудь сказать мне, если я что-то пропустил? Он продолжает бросать ошибку, указанную внизу после кода.Схема взлома Drupal 7 Breaking

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']); 
} 

ОШИБКА:

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') 

В итоге я заметил, что это было встроено в массив полей и должно быть снаружи/после него.

Итак, исправление было таким же простым, как перемещение этой строки в виде элемента массива массива license_agreements. Задача решена!