2016-09-21 1 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') 

는 그이 필드 배열에 포함하고 그 뒤에/외부로 필요하다고 알았어 끝났다.

그래서이 줄을 license_agreements 배열의 배열 요소로 옮기는 것만 큼 간단합니다. 문제 해결됨!