In 5.x-1.x, content_install() creates the 'required' and 'multiple' columns in the node_field table, and content_update_3() adds the 'db_storage' column:

required int NOT NULL default '0',
multiple int NOT NULL default '0',
db_storage int NOT NULL default 0

In 6.x-2.x, the schema sets these columns as tinyints, and the default value for db_storage has been changed to 1:

'required'        => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0),
'multiple'        => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0),
'db_storage'      => array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1),

Schema module reports this mis-match as:

* content_node_field
  * column required - difference on: size
    declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0)
    actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
  * column multiple - difference on: size
    declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0)
    actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)
  * column db_storage - differences on: size, default
    declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 1)
    actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => TRUE, 'default' => 0)

A new content_update_60xx() to re-set these attributes would sort this out.

CommentFileSizeAuthor
#1 cck-642190.patch2.83 KBjweowu

Comments

jweowu’s picture

Version: 6.x-2.6 » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new2.83 KB

In addition to the above, I've found that nodereference field tables from Drupal 5 have a signed column which should be unsigned.

e.g.:

* content_field_related_links
   * column field_related_links_nid - difference on: unsigned
     declared: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE)
     actual: array('description' => t('TODO: please describe this field!'), 'type' => 'int', 'not null' => FALSE)

With Drupal 5 now unsupported, there will be plenty of people upgrading from Drupal 5. It would be good to get these discrepancies sorted out.

Patch attached.

karens’s picture

Title: Schema mis-match when upgrading » Schema mis-match when upgrading from D5 to D6

Clarifying this report. No one has time to spend on D5 these days, especially fixes to an old upgrade path that was always problematic. This is why it is better not to wait so long to upgrade :(

Leaving this here in case someone else wants to tackle it, but I have no time to do it.

karens’s picture

Status: Needs review » Needs work

Also, as written this would run not only for sites trying to upgrade from D5 to D6 but also for all of the other 250,000 sites already using D6, potentially breaking them. So this is also 'Needs work'.

jweowu’s picture

On that last point, remember that a great many of those Drupal 6 sites would have started as Drupal 5 sites, and therefore would currently exhibit these issues. This isn't just for the sites which have yet to upgrade; it's a fix for all Drupal 6 sites which do not have the database schema that CCK thinks they do.

(Is there even a way to programmatically determine the upgrade history of a Drupal site?)