Could someone tell me if I've missed something in this? It keeps throwing the error mentioned at the bottom after the code block.
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
Really would love to get this solved.
Thanks!
So, courtesy of having another dev come help me try to find what was blowing things up, I managed to discover the issue as we worked through it.
'primary key' => array('license_id')
I ended up noticing that that was embedded within the fields array and needed to be outside/after it.
So, the fix was as simple as moving that line down as an array element of the license_agreements array. Problem solved!