Warning, /pim/akonadi/autotests/server/dbtest_data/dbinit_sqlite_incremental is written in an unsupported language. File is not indexed.

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