Ibrahim Awwal wrote:
Hi guys,
I was trying to upgrade my installation of mediawiki from 1.15.4 to 1.16,
following the procedures listed on the Mediawiki upgrade page, and I ran
into a database error along the way. I'm using Debian Lenny with PHP
5.2.6-1+lenny9 (apache2handler) and Postgres 8.3.12. During the upgrade
procedure I got this error:
Query: CREATE TABLE user_properties(
up_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE CASCADE,
up_property TEXT NOT NULL,
up_value TEXT
)
Function: DatabaseBase::sourceStream
Error: 1 ERROR: there is no unique constraint matching given keys for
referenced table "mwuser"
And now the wiki is down. Can anyone help me figure out what to do from this
point? Luckily I have daily backups of the database so that's not a huge
problem, but I'd like to get this up and running again ASAP. I actually
restored a backup over the database and tried to install mediawiki 1.15.5
(from Debian's backports repository, since Mediawiki's archives are down)
but now anything related to editing is broken. I did not try deleting the
database and then restoring the backup though, which I probably should when
I get the time. Unfortunately it's a private internal wiki but if any more
information is needed I'd be happy to provide it.
Thanks!
-Ibrahim Awwal
The field user_id on mwuser table should be NOT NULL PRIMARY KEY
DEFAULT nextval('user_user_id_seq'). The error seems to imply that it
isn't a primary key. I'd ALTER it to match that prototype.
The other option would be to manually create the user_properties table
without the REFERENCES ... ON DELETE CASCADE bit. Users are never
deleted, and the wiki does not rely on the referential integrity
provided by postgres so it is safe to do.
Once the user_properties can be created, rerun the upgrade. It should
continue from that point on.