The declarations in simplenews_schema() contain the following errors:

  1. The simplenews_mail_spool table incorrectly sets the unsigned attribute on its snid field. The simplenews_subscriber table declares this field without the unsigned attribute; tables which refer to this field in foreign keys should have a compatible declaration.
  2. For efficiency, the simplenews_mail_spool should be indexed by snid, tid.
  3. All of the foreign keys are declared incorrectly. From the Schema documentation:

    'foreign keys': An associative array of foreign keys ('keyname' => specification). Each specification is an array with 'table' and 'columns' elements that form a foreign key for the table.

    'table' is a string specifying the foreign table, and 'columns' is an associative array in the format 'source_column' => 'target_column'.

    Note: Foreign key definitions were added in Drupal 7 for documentation purposes only, and do not modify the database.

    Example from the {node} table:

      'foreign keys' => array(
        'node_revision' => array(
          'table' => 'node_revision',
          'columns' => array('vid' => 'vid'),
        ),
        'node_author' => array(
          'table' => 'users',
          'columns' => array('uid' => 'uid')
        ),
      ),
    

Comments

simon georges’s picture

Patch applies cleanly and doesn't seem to break anything.
I still have to check if there is something to do for D6 -> D7 upgrade.

Thanks, anyway !

miro_dietiker’s picture

Status: Needs review » Needs work

Thank you for the schema update.

Please note that regarding the index, we'll need to implement the hook_update_700x to allow already-installed 7.x-1.x installations to have a clean database...

Please avoid non-functional changes in a functional patch. (things like code cleanup...)

pillarsdotnet’s picture

Status: Needs work » Needs review
StatusFileSize
new3.54 KB

Corrected and re-rolled.

miro_dietiker’s picture

Status: Needs review » Fixed

Thank you.
BTW: The patch provided a parse error because of a missing bracket. Please review yourself first or at least write if something is completely untested..
Committed. Pushing soon.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.