I've detected two important problems in the upgrade procedure:

  • The update does not work with locale.module enabled. This happens because function locale() is called before table locales_source is created.
  • ALTER TABLE {table} ALTER COLUMN column DROP NOT NULL is not a valid MySQL syntax. ALTER TABLE {table} MODIFY new_definition must be used instead.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dries’s picture

Priority: Normal » Critical
Dries’s picture

Title: 4.5 migration » 4.5 migration broken when locale module is enabled
killes@www.drop.org’s picture

Assigned: Unassigned » killes@www.drop.org

David, can you provide more info? Before the new locale module was committed to core, the upgrade process was tested several times and found to be working.

David Poblador i Garcia’s picture

Steps to reproduce the problem:

  • Download Drupal 4.4.x and do a fresh install.
  • Go to configuration -> modules and enable locale.module.
  • Download Drupal 4.5-rc and replace the files (deleting old ones to avoid dups).
  • Change conf.php into the right settings.
  • Create manually tables users_roles and locales_meta.
  • Point the browser at http://host/update.php.
  • Choose 2004-03-11: First update since Drupal 4.4.0.

This makes Drupal crash:

2004-04-27
Fatal error: Table 'drupal.locales_source' doesn't exist
query: SELECT s.lid, t.translation FROM locales_source s
INNER JOIN locales_target t ON s.lid = t.lid
WHERE s.source = '%error: %message in %file on line %line.'
AND t.locale = ''
in /var/www/includes/database.mysql.inc on line 125

Hope to be helpful.

David Poblador i Garcia’s picture

I've found more details! There are four wrong SQL sentences at the end of update_85() that cause some errors to be written by watchdog.module. watchdog() uses t() to write the message, and given the fact locales_source is not yet created, it produces above error.

These are the wrong sentences:

ALTER TABLE aggregator_category ALTER COLUMN description DROP NOT NULL;
ALTER TABLE aggregator_item ALTER COLUMN description DROP NOT NULL;
ALTER TABLE aggregator_feed ALTER COLUMN description DROP NOT NULL;
ALTER TABLE aggregator_feed ALTER COLUMN image DROP NOT NULL;
David Poblador i Garcia’s picture

FileSize
974 bytes

I've written a patch which solves the problem. I've changed above four SQL sentences.

David Poblador i Garcia’s picture

FileSize
974 bytes

I've written a patch which solves the problem. I've changed above four SQL sentences.

Dries’s picture

What's wrong with these queries? Please elaborate.

David Poblador i Garcia’s picture

mysql> ALTER TABLE aggregator_feed ALTER COLUMN image DROP NOT NULL;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL' at line 1
mysql>

Tested on MySQL 4.0.21 and 3.23.49.

Dries’s picture

Committed to HEAD. Thanks.

Dries’s picture

Anonymous’s picture

Anonymous’s picture

Priority: Critical » Normal

I'm having more problems with upgrading to 4.5 from 4.4 when I had locale module installed on 4.4 (disabled before attempting to upgrade to 4.5).

The update.php file says that I should manually create table locales_meta, with the following sql:

CREATE TABLE locales_meta (
locale varchar(12) NOT NULL default '',
name varchar(64) NOT NULL default '',
enabled int(2) NOT NULL default '0',
isdefault int(2) NOT NULL default '0',
plurals int(1) NOT NULL default '0',
formula varchar(128) NOT NULL default '',
PRIMARY KEY (locale)
);

But there's already a locales_meta table, with the following (and different) structure:

CREATE TABLE `locales_meta` (
`locale` varchar(12) NOT NULL default '',
`name` varchar(64) NOT NULL default '',
`name_en` varchar(64) NOT NULL default '',
`status` int(2) NOT NULL default '0',
`plurals` int(1) NOT NULL default '0',
`formula` varchar(128) NOT NULL default '',
PRIMARY KEY (`locale`)
) TYPE=MyISAM;

There's also a locales_source and a locales_target table, which makes me think that I will encounter more trouble when I try to run the database update script.

Since I have only a single entry translated in locales, my workaround is to just drop locales_meta, locales_source, and locales_target (I can recreate them after update succeeds). But I think this is a bug in update procedure, caused by weirdness around locale being moved from contrib into core.

Cheryl

Anonymous’s picture

So I re-open this bug (sorry!).

Cheryl

killes@www.drop.org’s picture

Cheryl, you apparently have been using the contrib locale module for 4.4 which was later merged into core. The merge required a slightly reworked db structure. I did not provide an upgrade path for the 4.4 users. The proper way to upgrade would be to export the PO files, delete the tables, run upgrade.php, and re-import the PO files.

Anonymous’s picture