1 1. Drop foreign keys from the "Sessions" table:
3 `ALTER TABLE Sessions DROP FOREIGN KEY Sessions_ibfk_1;` should work in most
4 cases. Otherwise, check the output of `SHOW CREATE TABLE Sessions;` and use the
5 foreign key name shown there.
7 2. Run the following MySQL statements:
11 ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE;
12 ALTER TABLE PackageDepends
13 ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
14 ADD FOREIGN KEY (DepPkgID) REFERENCES Packages(ID) ON DELETE CASCADE;
15 ALTER TABLE PackageSources
16 ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
17 ALTER TABLE TU_VoteInfo
18 ADD FOREIGN KEY (SubmitterID) REFERENCES Users(ID) ON DELETE CASCADE;
20 ADD FOREIGN KEY (VoteID) REFERENCES TU_VoteInfo(ID) ON DELETE CASCADE,
21 ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
22 ALTER TABLE PackageComments
23 MODIFY DelUsersID INTEGER UNSIGNED NULL DEFAULT NULL;
24 UPDATE PackageComments SET DelUsersID = NULL WHERE DelUsersID = 0;
26 MODIFY SubmitterUID INTEGER UNSIGNED NULL DEFAULT NULL,
27 MODIFY MaintainerUID INTEGER UNSIGNED NULL DEFAULT NULL;
28 UPDATE Packages SET SubmitterUID = NULL WHERE SubmitterUID = 0;
29 UPDATE Packages SET MaintainerUID = NULL WHERE MaintainerUID = 0;
32 3. (optional) If you converted your database from MyISAM to InnoDB during the
33 upgrade process from 1.7.0 to 1.8.0 or from 1.8.0 to 1.8.1 without completely
34 rebuilding the database from the MySQL schema, you should additionally run the
35 following MySQL statements to add missing foreign keys:
39 ADD FOREIGN KEY (AccountTypeID) REFERENCES AccountTypes(ID) ON DELETE NO ACTION;
41 ADD FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION,
42 ADD FOREIGN KEY (SubmitterUID) REFERENCES Users(ID) ON DELETE NO ACTION,
43 ADD FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION;
44 ALTER TABLE PackageVotes
45 ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
46 ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
47 ALTER TABLE PackageComments
48 ADD FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
49 ADD FOREIGN KEY (DelUsersID) REFERENCES Users(ID) ON DELETE CASCADE,
50 ADD FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE;
51 ALTER TABLE CommentNotify
52 ADD FOREIGN KEY (PkgID) REFERENCES Packages(ID) ON DELETE CASCADE,
53 ADD FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE;
56 4. Merge "web/lib/config.inc.proto" with "web/lib/config.inc".