Magician
Visitor
|
Recreate database: Apply patch 31 fails - 2010/01/23 13:52
Hi, I had to recreate the swiss database.
It failed with patch 31. a snippit from the log:
| Code: | [2010.01.23 19:32:44] Applying database patch [0031]
[2010.01.23 19:32:44] Duplicate column name 'cat_id'
[2010.01.23 19:32:44] -- -----------------------------------------------------------------------------------------------
--
[2010.01.23 19:32:44] -- Update the internet bookmarks to be assigned categories and have certificates
[2010.01.23 19:32:44] -- ----------------------------------------------------------------------------------------------
---
[2010.01.23 19:32:44]
[2010.01.23 19:32:44] ALTER TABLE internet_urls ADD cat_id INT UNSIGNED NOT NULL DEFAULT 1
[2010.01.23 19:32:44] Duplicate column name 'certificate'
[2010.01.23 19:32:44]
[2010.01.23 19:32:44] ALTER TABLE internet_urls ADD certificate INT UNSIGNED NULL
[2010.01.23 19:32:44] Can't create table 'swiss.#sql-8b8_569' (errno: 150)
[2010.01.23 19:32:44]
[2010.01.23 19:32:44] ALTER TABLE internet_urls ADD CONSTRAINT FOREIGN KEY (certificate) REFERENCES certificates(cert_id) ON DELETE SET NULL
[2010.01.23 19:32:44] Failed to apply database patch [0031]
|
After looking in to this, I found the problem was the DB-engine of the certificates table, which was myisam, but should be InnoDb.
I altered update 31 to
| Code: |
-- -------------------------------------------------------------------------------------------------
-- Update the internet bookmarks to be assigned categories and have certificates
-- -------------------------------------------------------------------------------------------------
-- ALTER TABLE internet_urls ADD cat_id INT UNSIGNED NOT NULL DEFAULT 1;
-- ALTER TABLE internet_urls ADD certificate INT UNSIGNED NULL;
ALTER TABLE certificates ENGINE = InnoDB;
ALTER TABLE internet_urls ADD CONSTRAINT FOREIGN KEY (certificate) REFERENCES certificates(cert_id) ON DELETE SET NULL;
|
Maybe in the final patch the first two alter table queries need to be enabled, because they succeed the first time you try to apply this patch. (and I applied it multiple times)
I used the following environment:
Webserver : Apache v2.2.11
PHP : v5.2.8
MySQL : v5.1.30-community
SwissCenter: Subversion r1366
|