Warning, /pim/akonadi/autotests/server/dbtest_data/unittest_dbupdate.xml is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8"?> 0002 <!-- 0003 0004 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 0008 --> 0009 0010 0011 <!-- 0012 Akonadi Database Schema Update Description 0013 0014 update element: 0015 text: SQL statement to execute for update 0016 version attribute: the new schmema version 0017 abortOnFailure attribute: if true, the update must succeed, otherwise failures are ignored 0018 0019 Please note: if you're adding a column to the db then you DON'T need to add an update 0020 statement here. Add your column to akonadidb.xml instead: it will be added to the db automagically. 0021 --> 0022 <updates> 0023 0024 <update version="2" abortOnFailure="false"> 0025 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationTable DROP COLUMN existCount;</raw-sql> 0026 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationTable DROP COLUMN recentCount;</raw-sql> 0027 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationTable DROP COLUMN unseenCount;</raw-sql> 0028 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationTable DROP COLUMN firstUnseen;</raw-sql> 0029 </update> 0030 0031 <update version="3" abortOnFailure="false"> 0032 <raw-sql backends="mysql,psql,sqlite">UPDATE LocationTable SET subscribed = true;</raw-sql> 0033 </update> 0034 0035 <update version="4" abortOnFailure="false"> 0036 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationTable DROP COLUMN cachePolicyId;</raw-sql> 0037 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE ResourceTable DROP COLUMN cachePolicyId;</raw-sql> 0038 <raw-sql backends="mysql,psql,sqlite">DROP TABLE CachePolicyTable;</raw-sql> 0039 </update> 0040 0041 <update version="8" abortOnFailure="false"> 0042 <raw-sql backends="mysql,psql,sqlite">UPDATE PartTable SET name = 'PLD:ENVELOPE' WHERE name = 'ENVELOPE';</raw-sql> 0043 <raw-sql backends="mysql,psql,sqlite">UPDATE PartTable SET name = 'PLD:RFC822' WHERE name = 'RFC822';</raw-sql> 0044 <raw-sql backends="mysql,psql,sqlite">UPDATE PartTable SET name = 'PLD:HEAD' WHERE name = 'HEAD';</raw-sql> 0045 <raw-sql backends="mysql,psql,sqlite">UPDATE PartTable SET name = concat( 'ATR:', name ) WHERE substr( name, 1, 4 ) != 'PLD:';</raw-sql> 0046 </update> 0047 0048 <!-- the initializer runs first, so we will have all the new tables and columns already 0049 therefore we have to clean that up first --> 0050 <update version="10" abortOnFailure="true"> 0051 <raw-sql backends="mysql,psql,sqlite">DROP TABLE CollectionTable;</raw-sql> 0052 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationTable RENAME TO CollectionTable;</raw-sql> 0053 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE PimItemTable DROP COLUMN collectionId;</raw-sql> 0054 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE PimItemTable CHANGE locationId collectionId BIGINT;</raw-sql> 0055 <raw-sql backends="mysql,psql,sqlite">DROP TABLE CollectionAttributeTable;</raw-sql> 0056 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationAttributeTable CHANGE locationId collectionId BIGINT;</raw-sql> 0057 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationAttributeTable RENAME TO CollectionAttributeTable;</raw-sql> 0058 <raw-sql backends="mysql,psql,sqlite">DROP TABLE CollectionMimeTypeRelation;</raw-sql> 0059 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationMimeTypeRelation CHANGE Location_Id Collection_Id BIGINT NOT NULL DEFAULT '0';</raw-sql> 0060 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationMimeTypeRelation RENAME TO CollectionMimeTypeRelation;</raw-sql> 0061 <raw-sql backends="mysql,psql,sqlite">DROP TABLE CollectionPimItemRelation;</raw-sql> 0062 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationPimItemRelation CHANGE Location_Id Collection_Id BIGINT NOT NULL DEFAULT '0';</raw-sql> 0063 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE LocationPimItemRelation RENAME TO CollectionPimItemRelation;</raw-sql> 0064 </update> 0065 0066 <update version="12" abortOnFailure="false"> 0067 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE PartTable CHANGE datasize datasize BIGINT;</raw-sql> 0068 </update> 0069 0070 <update version="13" abortOnFailure="true"> 0071 <raw-sql backends="mysql,psql,sqlite">UPDATE CollectionTable SET parentId = NULL WHERE parentId = 0;</raw-sql> 0072 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE CollectionTable CHANGE parentId parentId BIGINT DEFAULT NULL;</raw-sql> 0073 </update> 0074 0075 <update version="14" abortOnFailure="false"> 0076 <raw-sql backends="mysql,psql,sqlite">UPDATE ResourceTable SET isVirtual = true WHERE name = 'akonadi_nepomuktag_resource';</raw-sql> 0077 <raw-sql backends="mysql,psql,sqlite">UPDATE ResourceTable SET isVirtual = true WHERE name = 'akonadi_search_resource';</raw-sql> 0078 </update> 0079 0080 <update version="15" abortOnFailure="false"> 0081 <raw-sql backends="mysql,psql,sqlite">UPDATE CollectionTable SET queryString = remoteId WHERE resourceId = 1 AND parentId IS NOT NULL;</raw-sql> 0082 <raw-sql backends="mysql,psql,sqlite">UPDATE CollectionTable SET queryLanguage = 'SPARQL' WHERE resourceId = 1 AND parentId IS NOT NULL;</raw-sql> 0083 </update> 0084 0085 <update version="16" abortOnFailure="false"> 0086 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE CollectionAttributeTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0087 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE CollectionMimeTypeRelation CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0088 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE CollectionPimItemRelation CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0089 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE CollectionTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0090 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE FlagTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0091 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE MimeTypeTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0092 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE PartTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0093 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE PimItemFlagRelation CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0094 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE PimitemTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0095 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE ResourceTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0096 <raw-sql backends="mysql,psql,sqlite">ALTER TABLE SchemaVersionTable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</raw-sql> 0097 </update> 0098 0099 <!-- change all string based columns to use BINARY flag, this makes the comparison operator 0100 finally work --> 0101 <update version="17" abortOnFailure="false"> 0102 <raw-sql backends="mysql">ALTER TABLE ResourceTable CHANGE name name VARCHAR(255) BINARY UNIQUE;</raw-sql> 0103 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE remoteId remoteId VARCHAR(255) BINARY;</raw-sql> 0104 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE remoteRevision remoteRevision VARCHAR(255) BINARY;</raw-sql> 0105 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE name name VARCHAR(255) BINARY;</raw-sql> 0106 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE cachePolicyLocalParts cachePolicyLocalParts VARCHAR(255) BINARY;</raw-sql> 0107 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE queryString queryString VARCHAR(255) BINARY;</raw-sql> 0108 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE queryLanguage queryLanguage VARCHAR(255) BINARY;</raw-sql> 0109 <raw-sql backends="mysql">ALTER TABLE MimeTypeTable CHANGE name name VARCHAR(255) BINARY UNIQUE;</raw-sql> 0110 <raw-sql backends="mysql">ALTER TABLE PimItemTable CHANGE remoteId remoteId VARCHAR(255) BINARY;</raw-sql> 0111 <raw-sql backends="mysql">ALTER TABLE PimItemTable CHANGE remoteRevision remoteRevision VARCHAR(255) BINARY;</raw-sql> 0112 <raw-sql backends="mysql">ALTER TABLE FlagTable CHANGE name name VARCHAR(255) BINARY UNIQUE;</raw-sql> 0113 <raw-sql backends="mysql">ALTER TABLE PartTable CHANGE name name VARCHAR(255) BINARY;</raw-sql> 0114 </update> 0115 0116 <!-- change all string based columns to VARBINARY to make indexes and comparison operator work --> 0117 <update version="18" abortOnFailure="false"> 0118 <raw-sql backends="mysql">ALTER TABLE ResourceTable CHANGE name name VARBINARY(255) UNIQUE;</raw-sql> 0119 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE remoteId remoteId VARBINARY(255);</raw-sql> 0120 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE remoteRevision remoteRevision VARBINARY(255);</raw-sql> 0121 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE name name VARBINARY(255);</raw-sql> 0122 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE cachePolicyLocalParts cachePolicyLocalParts VARBINARY(255);</raw-sql> 0123 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE queryString queryString VARBINARY(255);</raw-sql> 0124 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE queryLanguage queryLanguage VARBINARY(255);</raw-sql> 0125 <raw-sql backends="mysql">ALTER TABLE MimeTypeTable CHANGE name name VARBINARY(255) UNIQUE;</raw-sql> 0126 <raw-sql backends="mysql">ALTER TABLE PimItemTable CHANGE remoteId remoteId VARBINARY(255);</raw-sql> 0127 <raw-sql backends="mysql">ALTER TABLE PimItemTable CHANGE remoteRevision remoteRevision VARBINARY(255);</raw-sql> 0128 <raw-sql backends="mysql">ALTER TABLE FlagTable CHANGE name name VARBINARY(255) UNIQUE;</raw-sql> 0129 <raw-sql backends="mysql">ALTER TABLE PartTable CHANGE name name VARBINARY(255);</raw-sql> 0130 </update> 0131 <update version="19" abortOnFailure="false"> 0132 <raw-sql backends="mysql,psql,sqlite">UPDATE PimItemFlagRelation SET Flag_id=(SELECT id FROM FlagTable WHERE name='\\SEEN') WHERE Flag_id=(SELECT id FROM FlagTable WHERE name='\\Seen');</raw-sql> 0133 <raw-sql backends="mysql,psql,sqlite">DELETE FROM FlagTable WHERE name='\\Seen';</raw-sql> 0134 </update> 0135 0136 <!-- wider query column (only affects MySQL) --> 0137 <update version="20" abortOnFailure="false"> 0138 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE queryString queryString VARBINARY(1024);</raw-sql> 0139 </update> 0140 0141 <!-- even wider query column (only affects MySQL) --> 0142 <update version="21" abortOnFailure="false"> 0143 <raw-sql backends="mysql">ALTER TABLE CollectionTable CHANGE queryString queryString VARBINARY(32768);</raw-sql> 0144 </update> 0145 0146 <!-- fix previously wrongly used 32bit column type on n:m helper tables (TODO: also needed for the other backends) --> 0147 <update version="22" abortOnFailure="false"> 0148 <raw-sql backends="mysql">ALTER TABLE PimItemFlagRelation CHANGE PimItem_id PimItem_id BIGINT NOT NULL</raw-sql> 0149 <raw-sql backends="mysql">ALTER TABLE PimItemFlagRelation CHANGE Flag_id Flag_id BIGINT NOT NULL</raw-sql> 0150 <raw-sql backends="mysql">ALTER TABLE CollectionMimeTypeRelation CHANGE Collection_id Collection_id BIGINT NOT NULL</raw-sql> 0151 <raw-sql backends="mysql">ALTER TABLE CollectionMimeTypeRelation CHANGE MimeType_id MimeType_id BIGINT NOT NULL</raw-sql> 0152 <raw-sql backends="mysql">ALTER TABLE CollectionPimItemRelation CHANGE Collection_id Collection_id BIGINT NOT NULL</raw-sql> 0153 <raw-sql backends="mysql">ALTER TABLE CollectionPimItemRelation CHANGE PimItem_id PimItem_id BIGINT NOT NULL</raw-sql> 0154 </update> 0155 0156 <update version="23" abortOnFailure="false"> 0157 <raw-sql backends="mysql,psql">UPDATE CollectionTable SET isVirtual = true WHERE resourceId IN (SELECT id FROM ResourceTable WHERE isVirtual = true)</raw-sql> 0158 <raw-sql backends="sqlite">UPDATE CollectionTable SET isVirtual = 1 WHERE resourceId IN (SELECT id FROM ResourceTable WHERE isVirtual = 1)</raw-sql> 0159 </update> 0160 0161 <update version="24" abortOnFailure="false"> 0162 <raw-sql backends="psql">ALTER TABLE CollectionTable ALTER remoteId TYPE text USING convert_from(remoteId,'utf8');</raw-sql> 0163 <raw-sql backends="psql">ALTER TABLE CollectionTable ALTER remoteRevision TYPE text USING convert_from(remoteRevision,'utf8');</raw-sql> 0164 <raw-sql backends="psql">ALTER TABLE CollectionTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql> 0165 <raw-sql backends="psql">ALTER TABLE CollectionTable ALTER cachePolicyLocalParts TYPE text USING convert_from(cachePolicyLocalParts,'utf8');</raw-sql> 0166 <raw-sql backends="psql">ALTER TABLE CollectionTable ALTER queryString TYPE text USING convert_from(queryString,'utf8');</raw-sql> 0167 <raw-sql backends="psql">ALTER TABLE CollectionTable ALTER queryLanguage TYPE text USING convert_from(queryLanguage,'utf8');</raw-sql> 0168 <raw-sql backends="psql">ALTER TABLE FlagTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql> 0169 <raw-sql backends="psql">ALTER TABLE MimeTypeTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql> 0170 <raw-sql backends="psql">ALTER TABLE PartTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql> 0171 <raw-sql backends="psql">ALTER TABLE PimItemTable ALTER remoteId TYPE text USING convert_from(remoteId,'utf8');</raw-sql> 0172 <raw-sql backends="psql">ALTER TABLE PimItemTable ALTER remoteRevision TYPE text USING convert_from(remoteRevision,'utf8');</raw-sql> 0173 <raw-sql backends="psql">ALTER TABLE ResourceTable ALTER name TYPE text USING convert_from(name,'utf8');</raw-sql> 0174 </update> 0175 0176 <!-- adapt to new part type table layout 0177 (1) perform complex update by populating PartTypeTable and updating partTypeId column in PartTable 0178 (2) drop the old part name column in the part table 0179 --> 0180 <update version="25" abortOnFailure="true"> 0181 <complex-update backends="mysql,psql,sqlite" /> 0182 </update> 0183 0184 <update version="26" abortOnFailure="false"> 0185 <raw-sql backends="mysql,psql,sqlite">UPDATE CollectionTable SET queryAttributes = 'QUERYLANGUAGE SPARQL' WHERE queryLanguage = 'SPARQL';</raw-sql> 0186 <raw-sql backends="mysql,psql">ALTER TABLE CollectionTable DROP COLUMN queryLanguage;</raw-sql> 0187 </update> 0188 0189 <update version="28" abortOnFailure="false"> 0190 <raw-sql backends="mysql,psql,sqlite">UPDATE CollectionTable SET enabled = subscribed;</raw-sql> 0191 <raw-sql backends="mysql,psql">ALTER TABLE CollectionTable DROP COLUMN subscribed;</raw-sql> 0192 </update> 0193 0194 <!-- 0195 Update 30 fixes missing constraints on relation tables in PostgreSQL. 0196 We cannot just let DbInitializer create the foreign keys there, because data 0197 in the relation tables might reference rows from other tables that no longer 0198 exist. 0199 --> 0200 <update version="30" abortOnFailure="false"> 0201 <!-- PimItemFlagRelation --> 0202 <raw-sql backends="psql">DELETE FROM PimItemFlagRelation WHERE pimItem_id IN ( 0203 SELECT pimItem_id FROM PimItemFlagRelation 0204 LEFT JOIN PimItemTable ON PimItemFlagRelation.pimItem_id = PimItemTable.id 0205 WHERE PimItemTable.id IS NULL) 0206 </raw-sql> 0207 <raw-sql backends="psql">DELETE FROM PimItemFlagRelation WHERE flag_id IN ( 0208 SELECT flag_id FROM PimItemFlagRelation 0209 LEFT JOIN FlagTable ON PimItemFlagRelation.flag_id = FlagTable.id 0210 WHERE FlagTable.id IS NULL) 0211 </raw-sql> 0212 <!-- PimItemTagRelation --> 0213 <raw-sql backends="psql">DELETE FROM PimItemTagRelation WHERE pimItem_id IN ( 0214 SELECT pimItem_id FROM PimItemTagRelation 0215 LEFT JOIN PimItemTable ON PimItemTagRelation.pimItem_id = PimItemTable.id 0216 WHERE PimItemTable.id IS NULL) 0217 </raw-sql> 0218 <raw-sql backends="psql">DELETE FROM PimItemTagRelation WHERE tag_id IN ( 0219 SELECT tag_id FROM PimItemTagRelation 0220 LEFT JOIN TagTable ON PimItemTagRelation.tag_id = TagTable.id 0221 WHERE TagTable.id IS NULL) 0222 </raw-sql> 0223 <!-- CollectionMimeTypeRelation --> 0224 <raw-sql backends="psql">DELETE FROM CollectionMimeTypeRelation WHERE collection_id IN ( 0225 SELECT collection_id FROM CollectionMimeTypeRelation 0226 LEFT JOIN CollectionTable ON CollectionMimeTypeRelation.collection_id = CollectionTable.id 0227 WHERE CollectionTable.id IS NULL) 0228 </raw-sql> 0229 <raw-sql backends="psql">DELETE FROM CollectionMimeTypeRelation WHERE mimeType_id IN ( 0230 SELECT mimeType_id FROM CollectionMimeTypeRelation 0231 LEFT JOIN MimeTypeTable ON CollectionMimeTypeRelation.mimeType_id = MimeTypeTable.id 0232 WHERE MimeTypeTable.id IS NULL) 0233 </raw-sql> 0234 <!-- CollectionPimItemRelation --> 0235 <raw-sql backends="psql">DELETE FROM CollectionPimItemRelation WHERE collection_id IN ( 0236 SELECT collection_id FROM CollectionPimItemRelation 0237 LEFT JOIN CollectionTable ON CollectionPimItemRelation.collection_id = CollectionTable.id 0238 WHERE CollectionTable.id IS NULL) 0239 </raw-sql> 0240 <raw-sql backends="psql">DELETE FROM CollectionPimItemRelation WHERE pimItem_id IN ( 0241 SELECT pimItem_id FROM CollectionPimItemRelation 0242 LEFT JOIN PimItemTable ON CollectionPimItemRelation.pimItem_id = PimItemTable.id 0243 WHERE PimItemTable.id IS NULL) 0244 </raw-sql> 0245 </update> 0246 <!-- 0247 Update 31 fixes missing constraints on relation tables in MySQL. 0248 We cannot just let DbInitializer create the foreign keys there, because data 0249 in the relation tables might reference rows from other tables that no longer 0250 exist. 0251 --> 0252 <update version="31" abortOnFailure="false"> 0253 <!-- PimItemFlagRelation --> 0254 <raw-sql backends="mysql">DELETE FROM PimItemFlagRelation WHERE pimItem_id IN ( 0255 SELECT id FROM ( 0256 SELECT pimItem_id AS id FROM PimItemFlagRelation 0257 LEFT JOIN PimItemTable ON PimItemFlagRelation.pimItem_id = PimItemTable.id 0258 WHERE PimItemTable.id IS NULL) x) 0259 </raw-sql> 0260 <raw-sql backends="mysql">DELETE FROM PimItemFlagRelation WHERE flag_id IN ( 0261 SELECT id FROM ( 0262 SELECT flag_id AS id FROM PimItemFlagRelation 0263 LEFT JOIN FlagTable ON PimItemFlagRelation.flag_id = FlagTable.id 0264 WHERE FlagTable.id IS NULL) x) 0265 </raw-sql> 0266 <!-- PimItemTagRelation --> 0267 <raw-sql backends="mysql">DELETE FROM PimItemTagRelation WHERE pimItem_id IN ( 0268 SELECT id FROM ( 0269 SELECT pimItem_id AS id FROM PimItemTagRelation 0270 LEFT JOIN PimItemTable ON PimItemTagRelation.pimItem_id = PimItemTable.id 0271 WHERE PimItemTable.id IS NULL) x) 0272 </raw-sql> 0273 <raw-sql backends="mysql">DELETE FROM PimItemTagRelation WHERE tag_id IN ( 0274 SELECT id FROM ( 0275 SELECT tag_id AS id FROM PimItemTagRelation 0276 LEFT JOIN TagTable ON PimItemTagRelation.tag_id = TagTable.id 0277 WHERE TagTable.id IS NULL) x) 0278 </raw-sql> 0279 <!-- CollectionMimeTypeRelation --> 0280 <raw-sql backends="mysql">DELETE FROM CollectionMimeTypeRelation WHERE collection_id IN ( 0281 SELECT id FROM ( 0282 SELECT collection_id AS id FROM CollectionMimeTypeRelation 0283 LEFT JOIN CollectionTable ON CollectionMimeTypeRelation.collection_id = CollectionTable.id 0284 WHERE CollectionTable.id IS NULL) x) 0285 </raw-sql> 0286 <raw-sql backends="mysql">DELETE FROM CollectionMimeTypeRelation WHERE mimeType_id IN ( 0287 SELECT id FROM ( 0288 SELECT mimeType_id AS id FROM CollectionMimeTypeRelation 0289 LEFT JOIN MimeTypeTable ON CollectionMimeTypeRelation.mimeType_id = MimeTypeTable.id 0290 WHERE MimeTypeTable.id IS NULL) x) 0291 </raw-sql> 0292 <!-- CollectionPimItemRelation --> 0293 <raw-sql backends="mysql">DELETE FROM CollectionPimItemRelation WHERE collection_id IN ( 0294 SELECT id FROM ( 0295 SELECT collection_id AS id FROM CollectionPimItemRelation 0296 LEFT JOIN CollectionTable ON CollectionPimItemRelation.collection_id = CollectionTable.id 0297 WHERE CollectionTable.id IS NULL) x) 0298 </raw-sql> 0299 <raw-sql backends="mysql">DELETE FROM CollectionPimItemRelation WHERE pimItem_id IN ( 0300 SELECT id FROM ( 0301 SELECT pimItem_id AS id FROM CollectionPimItemRelation 0302 LEFT JOIN PimItemTable ON CollectionPimItemRelation.pimItem_id = PimItemTable.id 0303 WHERE PimItemTable.id IS NULL) x) 0304 </raw-sql> 0305 </update> 0306 <update version="33" abortOnFailure="false"> 0307 <raw-sql backends="psql">SELECT setval('tagtypetable_id_seq', (SELECT max(id) FROM TagTypeTable))</raw-sql> 0308 <raw-sql backends="psql">SELECT setval('relationtypetable_id_seq', (SELECT max(id) FROM RelationTypeTable))</raw-sql> 0309 </update> 0310 0311 <update version="35" abortOnFailure="true"> 0312 <raw-sql backends="mysql,sqlite">UPDATE PartTable SET storage = external;</raw-sql> 0313 <raw-sql backends="mysql">ALTER TABLE PartTable DROP COLUMN external;</raw-sql> 0314 <!-- TODO: SQLITE: drop the column as well, but SQLite does not have DROP COLUMN //--> 0315 <raw-sql backends="psql">UPDATE PartTable SET storage = cast(external as integer);</raw-sql> 0316 <raw-sql backends="psql">ALTER TABLE PartTable DROP COLUMN external;</raw-sql> 0317 </update> 0318 </updates>