Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the course of doing something similar to this module, amongst a number of things I found a pretty nasty bug in the install file. It's due to the use of 'tinyint' for the 'id'. This is just simply too small for a primary key. If you have more than 127 records, you may encounter problems using the table and over 255, a PDO Exception for sure since it can only hold 1 bit (255 is the largest number that can fit!)
Do it like this
<?php
function admin_notes_schema() {
$schema['admin_notes'] = array(
'fields' => array(
'id' => array(
'description' => 'The primary identifier for an admin note.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
//...
),
);
}
?>
Comments
Comment #1
blasthaus CreditAttribution: blasthaus commentedComment #2
HansKuiters CreditAttribution: HansKuiters commentedI agree with 'tinyint' being too small for a primary key. Came across this bug today. Changed it to int(4) in db.
Comment #3
blasthaus CreditAttribution: blasthaus commentedI ended up pretty much rewriting this module. If there is any interest from anyone, I can post it as a sandbox somewhere. It's working great. LMK
Comment #4
HansKuiters CreditAttribution: HansKuiters commentedFor now it works fine, but I'm interested in your work.
Comment #5
HansKuiters CreditAttribution: HansKuiters commentedComment #6
HansKuiters CreditAttribution: HansKuiters commentedSorry, wrong issue.