Warning, /pim/akonadi/autotests/server/dbtest_data/dbinit_sqlite is written in an unsupported language. File is not indexed.
0001 CREATE TABLE SchemaVersionTable (version INTEGER NOT NULL DEFAULT 0, 0002 generation INTEGER NOT NULL DEFAULT 0) 0003 0004 INSERT INTO SchemaVersionTable (version) VALUES (36) 0005 0006 CREATE TABLE ResourceTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0007 name TEXT UNIQUE NOT NULL, 0008 isVirtual BOOL DEFAULT 0) 0009 0010 INSERT INTO ResourceTable (isVirtual,name) VALUES (1,'akonadi_search_resource') 0011 0012 CREATE TABLE CollectionTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0013 remoteId TEXT, 0014 remoteRevision TEXT, 0015 name TEXT NOT NULL, 0016 parentId BIGINT, 0017 resourceId BIGINT NOT NULL, 0018 enabled BOOL NOT NULL DEFAULT 1, 0019 syncPref TINYINT DEFAULT 2, 0020 displayPref TINYINT DEFAULT 2, 0021 indexPref TINYINT DEFAULT 2, 0022 referenced BOOL NOT NULL DEFAULT 0, 0023 cachePolicyInherit BOOL NOT NULL DEFAULT 1, 0024 cachePolicyCheckInterval INTEGER NOT NULL DEFAULT -1, 0025 cachePolicyCacheTimeout INTEGER NOT NULL DEFAULT -1, 0026 cachePolicySyncOnDemand BOOL NOT NULL DEFAULT 0, 0027 cachePolicyLocalParts TEXT, 0028 queryString TEXT, 0029 queryAttributes TEXT, 0030 queryCollections TEXT, 0031 isVirtual BOOL DEFAULT 0, 0032 CONSTRAINT CollectionTableparentId_Collectionid_fk FOREIGN KEY (parentId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0033 CONSTRAINT CollectionTableresourceId_Resourceid_fk FOREIGN KEY (resourceId) REFERENCES ResourceTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0034 0035 INSERT INTO CollectionTable (isVirtual,name,parentId,resourceId) VALUES (1,'Search',NULL,1) 0036 0037 CREATE TABLE MimeTypeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0038 name TEXT UNIQUE NOT NULL) 0039 0040 CREATE TABLE PimItemTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0041 rev INTEGER NOT NULL DEFAULT 0, 0042 remoteId TEXT, 0043 remoteRevision TEXT, 0044 gid TEXT, 0045 collectionId BIGINT, 0046 mimeTypeId BIGINT, 0047 datetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 0048 atime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 0049 dirty BOOL, 0050 size BIGINT NOT NULL DEFAULT 0, 0051 CONSTRAINT PimItemTablecollectionId_Collectionid_fk FOREIGN KEY (collectionId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0052 CONSTRAINT PimItemTablemimeTypeId_MimeTypeid_fk FOREIGN KEY (mimeTypeId) REFERENCES MimeTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0053 0054 CREATE TABLE FlagTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0055 name TEXT UNIQUE NOT NULL) 0056 0057 CREATE TABLE PartTypeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0058 name TEXT NOT NULL, 0059 ns TEXT NOT NULL) 0060 0061 CREATE TABLE PartTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0062 pimItemId BIGINT NOT NULL, 0063 partTypeId BIGINT NOT NULL, 0064 data LONGBLOB, 0065 datasize BIGINT NOT NULL, 0066 version INTEGER DEFAULT 0, 0067 storage TINYINT DEFAULT 0, 0068 CONSTRAINT PartTablepimItemId_PimItemid_fk FOREIGN KEY (pimItemId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0069 CONSTRAINT PartTablepartTypeId_PartTypeid_fk FOREIGN KEY (partTypeId) REFERENCES PartTypeTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0070 0071 0072 CREATE TABLE CollectionAttributeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0073 collectionId BIGINT NOT NULL, 0074 type LONGBLOB NOT NULL, 0075 value LONGBLOB, 0076 CONSTRAINT CollectionAttributeTablecollectionId_Collectionid_fk FOREIGN KEY (collectionId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0077 0078 CREATE TABLE TagTypeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0079 name TEXT UNIQUE NOT NULL) 0080 0081 INSERT INTO TagTypeTable (name) VALUES ('PLAIN') 0082 0083 CREATE TABLE TagTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0084 gid TEXT NOT NULL, 0085 parentId BIGINT, 0086 typeId BIGINT DEFAULT 1, 0087 CONSTRAINT TagTableparentId_Tagid_fk FOREIGN KEY (parentId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0088 CONSTRAINT TagTabletypeId_TagTypeid_fk FOREIGN KEY (typeId) REFERENCES TagTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0089 0090 CREATE TABLE TagAttributeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0091 tagId BIGINT NOT NULL, 0092 type LONGBLOB NOT NULL, 0093 value LONGBLOB, 0094 CONSTRAINT TagAttributeTabletagId_Tagid_fk FOREIGN KEY (tagId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0095 0096 CREATE TABLE TagRemoteIdResourceRelationTable (tagId BIGINT NOT NULL, 0097 resourceId BIGINT NOT NULL, 0098 remoteId TEXT NOT NULL, 0099 CONSTRAINT TagRemoteIdResourceRelationTabletagId_Tagid_fk FOREIGN KEY (tagId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0100 CONSTRAINT TagRemoteIdResourceRelationTableresourceId_Resourceid_fk FOREIGN KEY (resourceId) REFERENCES ResourceTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0101 0102 CREATE TABLE RelationTypeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0103 name TEXT UNIQUE NOT NULL) 0104 0105 INSERT INTO RelationTypeTable (name) VALUES ('GENERIC') 0106 0107 CREATE TABLE RelationTable (leftId BIGINT NOT NULL, 0108 rightId BIGINT NOT NULL, 0109 typeId BIGINT DEFAULT 1, 0110 remoteId TEXT, 0111 CONSTRAINT RelationTableleftId_PimItemid_fk FOREIGN KEY (leftId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0112 CONSTRAINT RelationTablerightId_PimItemid_fk FOREIGN KEY (rightId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE 0113 DEFERRABLE INITIALLY DEFERRED, 0114 CONSTRAINT RelationTabletypeId_RelationTypeid_fk FOREIGN KEY (typeId) REFERENCES RelationTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0115 0116 CREATE TABLE PimItemFlagRelation (PimItem_id BIGINT NOT NULL, 0117 Flag_id BIGINT NOT NULL, 0118 PRIMARY KEY (PimItem_id, Flag_id), 0119 CONSTRAINT PimItemFlagRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0120 CONSTRAINT PimItemFlagRelationFlag_id_Flagid_fk FOREIGN KEY (Flag_id) REFERENCES FlagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0121 0122 CREATE TABLE PimItemTagRelation (PimItem_id BIGINT NOT NULL, 0123 Tag_id BIGINT NOT NULL, 0124 PRIMARY KEY (PimItem_id, Tag_id), 0125 CONSTRAINT PimItemTagRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0126 CONSTRAINT PimItemTagRelationTag_id_Tagid_fk FOREIGN KEY (Tag_id) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0127 0128 CREATE TABLE CollectionMimeTypeRelation (Collection_id BIGINT NOT NULL, 0129 MimeType_id BIGINT NOT NULL, 0130 PRIMARY KEY (Collection_id, MimeType_id), 0131 CONSTRAINT CollectionMimeTypeRelationCollection_id_Collectionid_fk FOREIGN KEY (Collection_id) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0132 CONSTRAINT CollectionMimeTypeRelationMimeType_id_MimeTypeid_fk FOREIGN KEY (MimeType_id) REFERENCES MimeTypeTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0133 0134 CREATE TABLE CollectionPimItemRelation (Collection_id BIGINT NOT NULL, 0135 PimItem_id BIGINT NOT NULL, 0136 PRIMARY KEY (Collection_id, PimItem_id), 0137 CONSTRAINT CollectionPimItemRelationCollection_id_Collectionid_fk FOREIGN KEY (Collection_id) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0138 CONSTRAINT CollectionPimItemRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0139 0140 CREATE UNIQUE INDEX CollectionTable_parentAndNameIndex ON CollectionTable (parentId,name) 0141 0142 CREATE INDEX CollectionTable_parentIndex ON CollectionTable (parentId) 0143 0144 CREATE INDEX CollectionTable_resourceIndex ON CollectionTable (resourceId) 0145 0146 CREATE INDEX CollectionTable_enabledIndex ON CollectionTable (enabled) 0147 0148 CREATE INDEX CollectionTable_syncPrefIndex ON CollectionTable (syncPref) 0149 0150 CREATE INDEX CollectionTable_displayPrefIndex ON CollectionTable (displayPref) 0151 0152 CREATE INDEX CollectionTable_indexPrefIndex ON CollectionTable (indexPref) 0153 0154 CREATE INDEX PimItemTable_collectionIndex ON PimItemTable (collectionId) 0155 0156 CREATE INDEX PimItemTable_mimeTypeIndex ON PimItemTable (mimeTypeId) 0157 0158 CREATE INDEX PimItemTable_gidIndex ON PimItemTable (gid) 0159 0160 CREATE INDEX PimItemTable_ridIndex ON PimItemTable (remoteId) 0161 0162 CREATE INDEX PimItemTable_idSortIndex ON PimItemTable (id DESC) 0163 0164 CREATE UNIQUE INDEX PartTypeTable_partTypeNameIndex ON PartTypeTable (ns,name) 0165 0166 CREATE UNIQUE INDEX PartTable_pimItemIdTypeIndex ON PartTable (pimItemId,partTypeId) 0167 0168 CREATE INDEX PartTable_pimItemIdSortIndex ON PartTable (pimItemId DESC) 0169 0170 CREATE INDEX PartTable_partTypeIndex ON PartTable (partTypeId) 0171 0172 CREATE INDEX CollectionAttributeTable_collectionIndex ON CollectionAttributeTable (collectionId) 0173 0174 CREATE INDEX TagTable_parentIndex ON TagTable (parentId) 0175 0176 CREATE INDEX TagTable_typeIndex ON TagTable (typeId) 0177 0178 CREATE INDEX TagAttributeTable_tagIndex ON TagAttributeTable (tagId) 0179 0180 CREATE UNIQUE INDEX TagRemoteIdResourceRelationTable_TagAndResourceIndex ON TagRemoteIdResourceRelationTable (tagId,resourceId) 0181 0182 CREATE INDEX TagRemoteIdResourceRelationTable_tagIndex ON TagRemoteIdResourceRelationTable (tagId) 0183 0184 CREATE INDEX TagRemoteIdResourceRelationTable_resourceIndex ON TagRemoteIdResourceRelationTable (resourceId) 0185 0186 CREATE UNIQUE INDEX RelationTable_RelationIndex ON RelationTable (leftId,rightId,typeId) 0187 0188 CREATE INDEX RelationTable_leftIndex ON RelationTable (leftId) 0189 0190 CREATE INDEX RelationTable_rightIndex ON RelationTable (rightId) 0191 0192 CREATE INDEX RelationTable_typeIndex ON RelationTable (typeId) 0193 0194 CREATE INDEX PimItemFlagRelation_PimItem_idIndex ON PimItemFlagRelation (PimItem_id) 0195 0196 CREATE INDEX PimItemFlagRelation_Flag_idIndex ON PimItemFlagRelation (Flag_id) 0197 0198 CREATE INDEX PimItemFlagRelation_pimItemIdSortIndex ON PimItemFlagRelation (pimitem_id DESC) 0199 0200 CREATE INDEX PimItemTagRelation_PimItem_idIndex ON PimItemTagRelation (PimItem_id) 0201 0202 CREATE INDEX PimItemTagRelation_Tag_idIndex ON PimItemTagRelation (Tag_id) 0203 0204 CREATE INDEX CollectionMimeTypeRelation_Collection_idIndex ON CollectionMimeTypeRelation (Collection_id) 0205 0206 CREATE INDEX CollectionMimeTypeRelation_MimeType_idIndex ON CollectionMimeTypeRelation (MimeType_id) 0207 0208 CREATE INDEX CollectionPimItemRelation_Collection_idIndex ON CollectionPimItemRelation (Collection_id) 0209 0210 CREATE INDEX CollectionPimItemRelation_PimItem_idIndex ON CollectionPimItemRelation (PimItem_id) 0211 0212 PRAGMA defer_foreign_keys=ON 0213 0214 BEGIN TRANSACTION 0215 0216 ALTER TABLE CollectionTable RENAME TO CollectionTable_old 0217 0218 CREATE TABLE CollectionTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0219 remoteId TEXT, 0220 remoteRevision TEXT, 0221 name TEXT NOT NULL, 0222 parentId BIGINT, 0223 resourceId BIGINT NOT NULL, 0224 enabled BOOL NOT NULL DEFAULT 1, 0225 syncPref TINYINT DEFAULT 2, 0226 displayPref TINYINT DEFAULT 2, 0227 indexPref TINYINT DEFAULT 2, 0228 referenced BOOL NOT NULL DEFAULT 0, 0229 cachePolicyInherit BOOL NOT NULL DEFAULT 1, 0230 cachePolicyCheckInterval INTEGER NOT NULL DEFAULT -1, 0231 cachePolicyCacheTimeout INTEGER NOT NULL DEFAULT -1, 0232 cachePolicySyncOnDemand BOOL NOT NULL DEFAULT 0, 0233 cachePolicyLocalParts TEXT, 0234 queryString TEXT, 0235 queryAttributes TEXT, 0236 queryCollections TEXT, 0237 isVirtual BOOL DEFAULT 0, 0238 CONSTRAINT CollectionTableparentId_Collectionid_fk FOREIGN KEY (parentId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0239 CONSTRAINT CollectionTableresourceId_Resourceid_fk FOREIGN KEY (resourceId) REFERENCES ResourceTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0240 0241 INSERT INTO CollectionTable SELECT * FROM CollectionTable_old 0242 0243 DROP TABLE CollectionTable_old 0244 0245 COMMIT 0246 0247 PRAGMA defer_foreign_keys=OFF 0248 0249 PRAGMA defer_foreign_keys=ON 0250 0251 BEGIN TRANSACTION 0252 0253 ALTER TABLE CollectionTable RENAME TO CollectionTable_old 0254 0255 CREATE TABLE CollectionTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0256 remoteId TEXT, 0257 remoteRevision TEXT, 0258 name TEXT NOT NULL, 0259 parentId BIGINT, 0260 resourceId BIGINT NOT NULL, 0261 enabled BOOL NOT NULL DEFAULT 1, 0262 syncPref TINYINT DEFAULT 2, 0263 displayPref TINYINT DEFAULT 2, 0264 indexPref TINYINT DEFAULT 2, 0265 referenced BOOL NOT NULL DEFAULT 0, 0266 cachePolicyInherit BOOL NOT NULL DEFAULT 1, 0267 cachePolicyCheckInterval INTEGER NOT NULL DEFAULT -1, 0268 cachePolicyCacheTimeout INTEGER NOT NULL DEFAULT -1, 0269 cachePolicySyncOnDemand BOOL NOT NULL DEFAULT 0, 0270 cachePolicyLocalParts TEXT, 0271 queryString TEXT, 0272 queryAttributes TEXT, 0273 queryCollections TEXT, 0274 isVirtual BOOL DEFAULT 0, 0275 CONSTRAINT CollectionTableparentId_Collectionid_fk FOREIGN KEY (parentId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0276 CONSTRAINT CollectionTableresourceId_Resourceid_fk FOREIGN KEY (resourceId) REFERENCES ResourceTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0277 0278 INSERT INTO CollectionTable SELECT * FROM CollectionTable_old 0279 0280 DROP TABLE CollectionTable_old 0281 0282 COMMIT 0283 0284 PRAGMA defer_foreign_keys=OFF 0285 0286 PRAGMA defer_foreign_keys=ON 0287 0288 BEGIN TRANSACTION 0289 0290 ALTER TABLE PimItemTable RENAME TO PimItemTable_old 0291 0292 CREATE TABLE PimItemTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0293 rev INTEGER NOT NULL DEFAULT 0, 0294 remoteId TEXT, 0295 remoteRevision TEXT, 0296 gid TEXT, 0297 collectionId BIGINT, 0298 mimeTypeId BIGINT, 0299 datetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 0300 atime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 0301 dirty BOOL, 0302 size BIGINT NOT NULL DEFAULT 0, 0303 CONSTRAINT PimItemTablecollectionId_Collectionid_fk FOREIGN KEY (collectionId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0304 CONSTRAINT PimItemTablemimeTypeId_MimeTypeid_fk FOREIGN KEY (mimeTypeId) REFERENCES MimeTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0305 0306 INSERT INTO PimItemTable SELECT * FROM PimItemTable_old 0307 0308 DROP TABLE PimItemTable_old 0309 0310 COMMIT 0311 0312 PRAGMA defer_foreign_keys=OFF 0313 0314 PRAGMA defer_foreign_keys=ON 0315 0316 BEGIN TRANSACTION 0317 0318 ALTER TABLE PimItemTable RENAME TO PimItemTable_old 0319 0320 CREATE TABLE PimItemTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0321 rev INTEGER NOT NULL DEFAULT 0, 0322 remoteId TEXT, 0323 remoteRevision TEXT, 0324 gid TEXT, 0325 collectionId BIGINT, 0326 mimeTypeId BIGINT, 0327 datetime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 0328 atime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 0329 dirty BOOL, 0330 size BIGINT NOT NULL DEFAULT 0, 0331 CONSTRAINT PimItemTablecollectionId_Collectionid_fk FOREIGN KEY (collectionId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0332 CONSTRAINT PimItemTablemimeTypeId_MimeTypeid_fk FOREIGN KEY (mimeTypeId) REFERENCES MimeTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0333 0334 INSERT INTO PimItemTable SELECT * FROM PimItemTable_old 0335 0336 DROP TABLE PimItemTable_old 0337 0338 COMMIT 0339 0340 PRAGMA defer_foreign_keys=OFF 0341 0342 PRAGMA defer_foreign_keys=ON 0343 0344 BEGIN TRANSACTION 0345 0346 ALTER TABLE PartTable RENAME TO PartTable_old 0347 0348 CREATE TABLE PartTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0349 pimItemId BIGINT NOT NULL, 0350 partTypeId BIGINT NOT NULL, 0351 data LONGBLOB, 0352 datasize BIGINT NOT NULL, 0353 version INTEGER DEFAULT 0, 0354 storage TINYINT DEFAULT 0, 0355 CONSTRAINT PartTablepimItemId_PimItemid_fk FOREIGN KEY (pimItemId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0356 CONSTRAINT PartTablepartTypeId_PartTypeid_fk FOREIGN KEY (partTypeId) REFERENCES PartTypeTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0357 0358 0359 INSERT INTO PartTable SELECT * FROM PartTable_old 0360 0361 DROP TABLE PartTable_old 0362 0363 COMMIT 0364 0365 PRAGMA defer_foreign_keys=OFF 0366 0367 PRAGMA defer_foreign_keys=ON 0368 0369 BEGIN TRANSACTION 0370 0371 ALTER TABLE PartTable RENAME TO PartTable_old 0372 0373 CREATE TABLE PartTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0374 pimItemId BIGINT NOT NULL, 0375 partTypeId BIGINT NOT NULL, 0376 data LONGBLOB, 0377 datasize BIGINT NOT NULL, 0378 version INTEGER DEFAULT 0, 0379 storage TINYINT DEFAULT 0, 0380 CONSTRAINT PartTablepimItemId_PimItemid_fk FOREIGN KEY (pimItemId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0381 CONSTRAINT PartTablepartTypeId_PartTypeid_fk FOREIGN KEY (partTypeId) REFERENCES PartTypeTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0382 0383 0384 INSERT INTO PartTable SELECT * FROM PartTable_old 0385 0386 DROP TABLE PartTable_old 0387 0388 COMMIT 0389 0390 PRAGMA defer_foreign_keys=OFF 0391 0392 PRAGMA defer_foreign_keys=ON 0393 0394 BEGIN TRANSACTION 0395 0396 ALTER TABLE CollectionAttributeTable RENAME TO CollectionAttributeTable_old 0397 0398 CREATE TABLE CollectionAttributeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0399 collectionId BIGINT NOT NULL, 0400 type LONGBLOB NOT NULL, 0401 value LONGBLOB, 0402 CONSTRAINT CollectionAttributeTablecollectionId_Collectionid_fk FOREIGN KEY (collectionId) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0403 0404 INSERT INTO CollectionAttributeTable SELECT * FROM CollectionAttributeTable_old 0405 0406 DROP TABLE CollectionAttributeTable_old 0407 0408 COMMIT 0409 0410 PRAGMA defer_foreign_keys=OFF 0411 0412 PRAGMA defer_foreign_keys=ON 0413 0414 BEGIN TRANSACTION 0415 0416 ALTER TABLE TagTable RENAME TO TagTable_old 0417 0418 CREATE TABLE TagTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0419 gid TEXT NOT NULL, 0420 parentId BIGINT, 0421 typeId BIGINT DEFAULT 1, 0422 CONSTRAINT TagTableparentId_Tagid_fk FOREIGN KEY (parentId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0423 CONSTRAINT TagTabletypeId_TagTypeid_fk FOREIGN KEY (typeId) REFERENCES TagTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0424 0425 INSERT INTO TagTable SELECT * FROM TagTable_old 0426 0427 DROP TABLE TagTable_old 0428 0429 COMMIT 0430 0431 PRAGMA defer_foreign_keys=OFF 0432 0433 PRAGMA defer_foreign_keys=ON 0434 0435 BEGIN TRANSACTION 0436 0437 ALTER TABLE TagTable RENAME TO TagTable_old 0438 0439 CREATE TABLE TagTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0440 gid TEXT NOT NULL, 0441 parentId BIGINT, 0442 typeId BIGINT DEFAULT 1, 0443 CONSTRAINT TagTableparentId_Tagid_fk FOREIGN KEY (parentId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0444 CONSTRAINT TagTabletypeId_TagTypeid_fk FOREIGN KEY (typeId) REFERENCES TagTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0445 0446 INSERT INTO TagTable SELECT * FROM TagTable_old 0447 0448 DROP TABLE TagTable_old 0449 0450 COMMIT 0451 0452 PRAGMA defer_foreign_keys=OFF 0453 0454 PRAGMA defer_foreign_keys=ON 0455 0456 BEGIN TRANSACTION 0457 0458 ALTER TABLE TagAttributeTable RENAME TO TagAttributeTable_old 0459 0460 0461 CREATE TABLE TagAttributeTable (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 0462 tagId BIGINT NOT NULL, 0463 type LONGBLOB NOT NULL, 0464 value LONGBLOB, 0465 CONSTRAINT TagAttributeTabletagId_Tagid_fk FOREIGN KEY (tagId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0466 0467 INSERT INTO TagAttributeTable SELECT * FROM TagAttributeTable_old 0468 0469 DROP TABLE TagAttributeTable_old 0470 0471 COMMIT 0472 0473 PRAGMA defer_foreign_keys=OFF 0474 0475 PRAGMA defer_foreign_keys=ON 0476 0477 BEGIN TRANSACTION 0478 0479 ALTER TABLE TagRemoteIdResourceRelationTable RENAME TO TagRemoteIdResourceRelationTable_old 0480 0481 CREATE TABLE TagRemoteIdResourceRelationTable (tagId BIGINT NOT NULL, 0482 resourceId BIGINT NOT NULL, 0483 remoteId TEXT NOT NULL, 0484 CONSTRAINT TagRemoteIdResourceRelationTabletagId_Tagid_fk FOREIGN KEY (tagId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0485 CONSTRAINT TagRemoteIdResourceRelationTableresourceId_Resourceid_fk FOREIGN KEY (resourceId) REFERENCES ResourceTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0486 0487 INSERT INTO TagRemoteIdResourceRelationTable SELECT * FROM TagRemoteIdResourceRelationTable_old 0488 0489 DROP TABLE TagRemoteIdResourceRelationTable_old 0490 0491 COMMIT 0492 0493 PRAGMA defer_foreign_keys=OFF 0494 0495 PRAGMA defer_foreign_keys=ON 0496 0497 BEGIN TRANSACTION 0498 0499 ALTER TABLE TagRemoteIdResourceRelationTable RENAME TO TagRemoteIdResourceRelationTable_old 0500 0501 CREATE TABLE TagRemoteIdResourceRelationTable (tagId BIGINT NOT NULL, 0502 resourceId BIGINT NOT NULL, 0503 remoteId TEXT NOT NULL, 0504 CONSTRAINT TagRemoteIdResourceRelationTabletagId_Tagid_fk FOREIGN KEY (tagId) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0505 CONSTRAINT TagRemoteIdResourceRelationTableresourceId_Resourceid_fk FOREIGN KEY (resourceId) REFERENCES ResourceTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0506 0507 INSERT INTO TagRemoteIdResourceRelationTable SELECT * FROM TagRemoteIdResourceRelationTable_old 0508 0509 DROP TABLE TagRemoteIdResourceRelationTable_old 0510 0511 COMMIT 0512 0513 PRAGMA defer_foreign_keys=OFF 0514 0515 PRAGMA defer_foreign_keys=ON 0516 0517 BEGIN TRANSACTION 0518 0519 ALTER TABLE RelationTable RENAME TO RelationTable_old 0520 0521 CREATE TABLE RelationTable (leftId BIGINT NOT NULL, 0522 rightId BIGINT NOT NULL, 0523 typeId BIGINT DEFAULT 1, 0524 remoteId TEXT, 0525 CONSTRAINT RelationTableleftId_PimItemid_fk FOREIGN KEY (leftId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0526 CONSTRAINT RelationTablerightId_PimItemid_fk FOREIGN KEY (rightId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE 0527 DEFERRABLE INITIALLY DEFERRED, 0528 CONSTRAINT RelationTabletypeId_RelationTypeid_fk FOREIGN KEY (typeId) REFERENCES RelationTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0529 0530 0531 INSERT INTO RelationTable SELECT * FROM RelationTable_old 0532 0533 DROP TABLE RelationTable_old 0534 0535 COMMIT 0536 0537 PRAGMA defer_foreign_keys=OFF 0538 0539 PRAGMA defer_foreign_keys=ON 0540 0541 BEGIN TRANSACTION 0542 0543 ALTER TABLE RelationTable RENAME TO RelationTable_old 0544 0545 CREATE TABLE RelationTable (leftId BIGINT NOT NULL, 0546 rightId BIGINT NOT NULL, 0547 typeId BIGINT DEFAULT 1, 0548 remoteId TEXT, 0549 CONSTRAINT RelationTableleftId_PimItemid_fk FOREIGN KEY (leftId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0550 CONSTRAINT RelationTablerightId_PimItemid_fk FOREIGN KEY (rightId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE 0551 DEFERRABLE INITIALLY DEFERRED, 0552 CONSTRAINT RelationTabletypeId_RelationTypeid_fk FOREIGN KEY (typeId) REFERENCES RelationTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0553 0554 0555 INSERT INTO RelationTable SELECT * FROM RelationTable_old 0556 0557 DROP TABLE RelationTable_old 0558 0559 COMMIT 0560 0561 PRAGMA defer_foreign_keys=OFF 0562 0563 PRAGMA defer_foreign_keys=ON 0564 0565 BEGIN TRANSACTION 0566 0567 ALTER TABLE RelationTable RENAME TO RelationTable_old 0568 0569 CREATE TABLE RelationTable (leftId BIGINT NOT NULL, 0570 rightId BIGINT NOT NULL, 0571 typeId BIGINT DEFAULT 1, 0572 remoteId TEXT, 0573 CONSTRAINT RelationTableleftId_PimItemid_fk FOREIGN KEY (leftId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0574 CONSTRAINT RelationTablerightId_PimItemid_fk FOREIGN KEY (rightId) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE 0575 DEFERRABLE INITIALLY DEFERRED, 0576 CONSTRAINT RelationTabletypeId_RelationTypeid_fk FOREIGN KEY (typeId) REFERENCES RelationTypeTable(id) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED) 0577 0578 0579 INSERT INTO RelationTable SELECT * FROM RelationTable_old 0580 0581 DROP TABLE RelationTable_old 0582 0583 COMMIT 0584 0585 PRAGMA defer_foreign_keys=OFF 0586 0587 PRAGMA defer_foreign_keys=ON 0588 0589 BEGIN TRANSACTION 0590 0591 ALTER TABLE PimItemFlagRelation RENAME TO PimItemFlagRelation_old 0592 0593 CREATE TABLE PimItemFlagRelation (PimItem_id BIGINT NOT NULL, 0594 Flag_id BIGINT NOT NULL, 0595 PRIMARY KEY (PimItem_id, Flag_id), 0596 CONSTRAINT PimItemFlagRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0597 CONSTRAINT PimItemFlagRelationFlag_id_Flagid_fk FOREIGN KEY (Flag_id) REFERENCES FlagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0598 0599 0600 INSERT INTO PimItemFlagRelation SELECT * FROM PimItemFlagRelation_old 0601 0602 DROP TABLE PimItemFlagRelation_old 0603 0604 COMMIT 0605 0606 PRAGMA defer_foreign_keys=OFF 0607 0608 0609 PRAGMA defer_foreign_keys=ON 0610 0611 BEGIN TRANSACTION 0612 0613 ALTER TABLE PimItemFlagRelation RENAME TO PimItemFlagRelation_old 0614 0615 CREATE TABLE PimItemFlagRelation (PimItem_id BIGINT NOT NULL, 0616 Flag_id BIGINT NOT NULL, 0617 PRIMARY KEY (PimItem_id, Flag_id), 0618 CONSTRAINT PimItemFlagRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0619 CONSTRAINT PimItemFlagRelationFlag_id_Flagid_fk FOREIGN KEY (Flag_id) REFERENCES FlagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0620 0621 0622 INSERT INTO PimItemFlagRelation SELECT * FROM PimItemFlagRelation_old 0623 0624 DROP TABLE PimItemFlagRelation_old 0625 0626 COMMIT 0627 0628 PRAGMA defer_foreign_keys=OFF 0629 0630 PRAGMA defer_foreign_keys=ON 0631 0632 BEGIN TRANSACTION 0633 0634 ALTER TABLE PimItemTagRelation RENAME TO PimItemTagRelation_old 0635 0636 CREATE TABLE PimItemTagRelation (PimItem_id BIGINT NOT NULL, 0637 Tag_id BIGINT NOT NULL, 0638 PRIMARY KEY (PimItem_id, Tag_id), 0639 CONSTRAINT PimItemTagRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0640 CONSTRAINT PimItemTagRelationTag_id_Tagid_fk FOREIGN KEY (Tag_id) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0641 0642 INSERT INTO PimItemTagRelation SELECT * FROM PimItemTagRelation_old 0643 0644 DROP TABLE PimItemTagRelation_old 0645 0646 COMMIT 0647 0648 PRAGMA defer_foreign_keys=OFF 0649 0650 PRAGMA defer_foreign_keys=ON 0651 0652 BEGIN TRANSACTION 0653 0654 ALTER TABLE PimItemTagRelation RENAME TO PimItemTagRelation_old 0655 0656 CREATE TABLE PimItemTagRelation (PimItem_id BIGINT NOT NULL, 0657 Tag_id BIGINT NOT NULL, 0658 PRIMARY KEY (PimItem_id, Tag_id), 0659 CONSTRAINT PimItemTagRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0660 CONSTRAINT PimItemTagRelationTag_id_Tagid_fk FOREIGN KEY (Tag_id) REFERENCES TagTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0661 0662 INSERT INTO PimItemTagRelation SELECT * FROM PimItemTagRelation_old 0663 0664 DROP TABLE PimItemTagRelation_old 0665 0666 COMMIT 0667 0668 PRAGMA defer_foreign_keys=OFF 0669 0670 PRAGMA defer_foreign_keys=ON 0671 0672 BEGIN TRANSACTION 0673 0674 ALTER TABLE CollectionMimeTypeRelation RENAME TO CollectionMimeTypeRelation_old 0675 0676 CREATE TABLE CollectionMimeTypeRelation (Collection_id BIGINT NOT NULL, 0677 MimeType_id BIGINT NOT NULL, 0678 PRIMARY KEY (Collection_id, MimeType_id), 0679 CONSTRAINT CollectionMimeTypeRelationCollection_id_Collectionid_fk FOREIGN KEY (Collection_id) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0680 CONSTRAINT CollectionMimeTypeRelationMimeType_id_MimeTypeid_fk FOREIGN KEY (MimeType_id) REFERENCES MimeTypeTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0681 0682 INSERT INTO CollectionMimeTypeRelation SELECT * FROM CollectionMimeTypeRelation_old 0683 0684 DROP TABLE CollectionMimeTypeRelation_old 0685 0686 COMMIT 0687 0688 PRAGMA defer_foreign_keys=OFF 0689 0690 PRAGMA defer_foreign_keys=ON 0691 0692 BEGIN TRANSACTION 0693 0694 ALTER TABLE CollectionMimeTypeRelation RENAME TO CollectionMimeTypeRelation_old 0695 0696 CREATE TABLE CollectionMimeTypeRelation (Collection_id BIGINT NOT NULL, 0697 MimeType_id BIGINT NOT NULL, 0698 PRIMARY KEY (Collection_id, MimeType_id), 0699 CONSTRAINT CollectionMimeTypeRelationCollection_id_Collectionid_fk FOREIGN KEY (Collection_id) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0700 CONSTRAINT CollectionMimeTypeRelationMimeType_id_MimeTypeid_fk FOREIGN KEY (MimeType_id) REFERENCES MimeTypeTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0701 0702 INSERT INTO CollectionMimeTypeRelation SELECT * FROM CollectionMimeTypeRelation_old 0703 0704 DROP TABLE CollectionMimeTypeRelation_old 0705 0706 COMMIT 0707 0708 PRAGMA defer_foreign_keys=OFF 0709 0710 PRAGMA defer_foreign_keys=ON 0711 0712 BEGIN TRANSACTION 0713 0714 ALTER TABLE CollectionPimItemRelation RENAME TO CollectionPimItemRelation_old 0715 0716 CREATE TABLE CollectionPimItemRelation (Collection_id BIGINT NOT NULL, 0717 PimItem_id BIGINT NOT NULL, 0718 PRIMARY KEY (Collection_id, PimItem_id), 0719 CONSTRAINT CollectionPimItemRelationCollection_id_Collectionid_fk FOREIGN KEY (Collection_id) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0720 CONSTRAINT CollectionPimItemRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0721 0722 INSERT INTO CollectionPimItemRelation SELECT * FROM CollectionPimItemRelation_old 0723 0724 DROP TABLE CollectionPimItemRelation_old 0725 0726 COMMIT 0727 0728 PRAGMA defer_foreign_keys=OFF 0729 0730 PRAGMA defer_foreign_keys=ON 0731 0732 BEGIN TRANSACTION 0733 0734 ALTER TABLE CollectionPimItemRelation RENAME TO CollectionPimItemRelation_old 0735 0736 CREATE TABLE CollectionPimItemRelation (Collection_id BIGINT NOT NULL, 0737 PimItem_id BIGINT NOT NULL, 0738 PRIMARY KEY (Collection_id, PimItem_id), 0739 CONSTRAINT CollectionPimItemRelationCollection_id_Collectionid_fk FOREIGN KEY (Collection_id) REFERENCES CollectionTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 0740 CONSTRAINT CollectionPimItemRelationPimItem_id_PimItemid_fk FOREIGN KEY (PimItem_id) REFERENCES PimItemTable(id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED) 0741 0742 INSERT INTO CollectionPimItemRelation SELECT * FROM CollectionPimItemRelation_old 0743 0744 DROP TABLE CollectionPimItemRelation_old 0745 0746 COMMIT 0747 0748 PRAGMA defer_foreign_keys=OFF