Skip to content
Permalink
Browse files

Updates/SQL

 * noticed having comments inside querys in these files breaks them
 * also there appear to be files with \r line endings left
  • Loading branch information
Sarjuuk committed Mar 21, 2017
1 parent 9516aff commit f9416c549d120b39c2f6a7b85ca8019a52344c01
Showing with 926 additions and 932 deletions.
  1. +0 −1 .gitattributes
  2. +13 −13 setup/updates/1433023200_01.sql
  3. +2 −2 setup/updates/1433023200_02.sql
  4. +79 −79 setup/updates/1433793600_01.sql
  5. +2 −2 setup/updates/1435777200_01.sql
  6. +15 −15 setup/updates/1436392800_01.sql
  7. +5 −5 setup/updates/1436619600_01.sql
  8. +1 −1 setup/updates/1436634000_01.sql
  9. +58 −58 setup/updates/1436634000_02.sql
  10. +52 −52 setup/updates/1436735830_01.sql
  11. +1 −1 setup/updates/1436739821_01.sql
  12. +4 −4 setup/updates/1436903207_01.sql
  13. +15 −15 setup/updates/1437329787_01.sql
  14. +31 −31 setup/updates/1437430574_01.sql
  15. +2 −2 setup/updates/1437472069_01.sql
  16. +68 −68 setup/updates/1438620486_01.sql
  17. +23 −23 setup/updates/1438715648_01.sql
  18. +53 −53 setup/updates/1438878038_01.sql
  19. +3 −3 setup/updates/1438970456_01.sql
  20. +15 −15 setup/updates/1439297934_01.sql
  21. +1 −1 setup/updates/1439469082_01.sql
  22. +7 −7 setup/updates/1439590146_01.sql
  23. +1 −1 setup/updates/1439840492_01.sql
  24. +1 −1 setup/updates/1439909965_01.sql
  25. +0 −1 setup/updates/1439924313_01.sql
  26. +2 −2 setup/updates/1445293761_01.sql
  27. +101 −105 setup/updates/1446293928_01.sql
  28. +3 −3 setup/updates/1446917082_01.sql
  29. +3 −3 setup/updates/1448204650_01.sql
  30. +1 −1 setup/updates/1448727750_01.sql
  31. +1 −1 setup/updates/1452718627_01.sql
  32. +349 −349 setup/updates/1456585695_01.sql
  33. +8 −8 setup/updates/1484926142_01.sql
  34. +1 −1 setup/updates/1486948902_01.sql
  35. +1 −1 setup/updates/1488061468_01.sql
  36. +2 −2 setup/updates/1489291710_01.sql
  37. +2 −2 setup/updates/1489942886_01.sql
@@ -2,4 +2,3 @@
*.js text eol=lf
*.css text eol=lf
*.sql text eol=lf

@@ -1,13 +1,13 @@
ALTER TABLE `aowow_creature`
ADD INDEX `difficultyEntry1` (`difficultyEntry1`),
ADD INDEX `difficultyEntry2` (`difficultyEntry2`),
ADD INDEX `difficultyEntry3` (`difficultyEntry3`);

UPDATE aowow_items i, aowow_spell s SET i.class = 0, i.subClass = 6 WHERE s.Id = i.spellId1 AND s.effect1Id = 53 AND i.classBak = 12;
UPDATE aowow_items SET class = 12 WHERE classBak = 15 AND startQuest <> 0 AND name_loc0 NOT LIKE "sayge\'s fortune%";
UPDATE aowow_items SET subClass = 3 WHERE classBak = 15 AND subClassBak = 0 AND holidayId <> 0;
UPDATE aowow_items SET subClass = 11 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 773;
UPDATE aowow_items SET subClass = 9 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 356;
UPDATE aowow_items SET subClass = 12 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 186;
UPDATE aowow_items SET subClass = 5 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 185;
UPDATE aowow_items SET subClass = 6 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 171;
ALTER TABLE `aowow_creature`
ADD INDEX `difficultyEntry1` (`difficultyEntry1`),
ADD INDEX `difficultyEntry2` (`difficultyEntry2`),
ADD INDEX `difficultyEntry3` (`difficultyEntry3`);

UPDATE aowow_items i, aowow_spell s SET i.class = 0, i.subClass = 6 WHERE s.Id = i.spellId1 AND s.effect1Id = 53 AND i.classBak = 12;
UPDATE aowow_items SET class = 12 WHERE classBak = 15 AND startQuest <> 0 AND name_loc0 NOT LIKE "sayge\'s fortune%";
UPDATE aowow_items SET subClass = 3 WHERE classBak = 15 AND subClassBak = 0 AND holidayId <> 0;
UPDATE aowow_items SET subClass = 11 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 773;
UPDATE aowow_items SET subClass = 9 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 356;
UPDATE aowow_items SET subClass = 12 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 186;
UPDATE aowow_items SET subClass = 5 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 185;
UPDATE aowow_items SET subClass = 6 WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = 171;
@@ -1,2 +1,2 @@
UPDATE aowow_zones SET mapId = 1 WHERE id IN (14,15,16,17,141,148,215,331,332,357,361,377,400,405,406,440,457,490,493,616,618,876,1377,1637,1638,1657,1941,2159,2917,3478,3524,3525,3557);
UPDATE aowow_zones SET mapId = 1 WHERE parentArea IN (14,15,16,17,141,148,215,331,332,357,361,377,400,405,406,440,457,490,493,616,618,876,1377,1637,1638,1657,1941,2159,2917,3478,3524,3525,3557);
UPDATE aowow_zones SET mapId = 1 WHERE id IN (14,15,16,17,141,148,215,331,332,357,361,377,400,405,406,440,457,490,493,616,618,876,1377,1637,1638,1657,1941,2159,2917,3478,3524,3525,3557);
UPDATE aowow_zones SET mapId = 1 WHERE parentArea IN (14,15,16,17,141,148,215,331,332,357,361,377,400,405,406,440,457,490,493,616,618,876,1377,1637,1638,1657,1941,2159,2917,3478,3524,3525,3557);
@@ -1,79 +1,79 @@
-- ***************************
-- * change engine to InnoDB *
-- * unify userId-fields *
-- ***************************

ALTER TABLE `aowow_account`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT;

ALTER TABLE `aowow_account_banned`
ALTER `userId` DROP DEFAULT,
ALTER `staffId` DROP DEFAULT;
ALTER TABLE `aowow_account_banned`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `userId` `userId` INT(10) UNSIGNED NOT NULL COMMENT 'affected accountId' AFTER `id`,
CHANGE COLUMN `staffId` `staffId` INT(10) UNSIGNED NOT NULL COMMENT 'executive accountId' AFTER `userId`;

ALTER TABLE `aowow_account_cookies`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT;

ALTER TABLE `aowow_account_reputation`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT;

ALTER TABLE `aowow_account_weightscales`
ALTER `account` DROP DEFAULT;
ALTER TABLE `aowow_account_weightscales`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `account` `userId` INT(10) UNSIGNED NOT NULL AFTER `id`;

ALTER TABLE `aowow_screenshots`
ALTER `uploader` DROP DEFAULT;
ALTER TABLE `aowow_screenshots`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `uploader` `userIdOwner` INT(10) UNSIGNED NULL AFTER `typeId`,
CHANGE COLUMN `approvedBy` `userIdApprove` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `status`,
CHANGE COLUMN `deletedBy` `userIdDelete` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `userIdApprove`;

ALTER TABLE `aowow_videos`
ALTER `uploader` DROP DEFAULT;
ALTER TABLE `aowow_videos`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `uploader` `userIdOwner` INT(10) UNSIGNED NULL AFTER `typeId`,
CHANGE COLUMN `approvedBy` `userIdApprove` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `status`,
ADD COLUMN `userIdeDelete` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `userIdApprove`;

-- **********************
-- * apply foreign keys *
-- **********************

ALTER TABLE aowow_account_cookies ADD CONSTRAINT FK_acc_cookies FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_account_banned ADD CONSTRAINT FK_acc_banned FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_account_reputation ADD CONSTRAINT FK_acc_rep FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_account_weightscales ADD CONSTRAINT FK_acc_weights FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_screenshots ADD CONSTRAINT FK_acc_ss FOREIGN KEY (userIdOwner) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE SET NULL
;
ALTER TABLE aowow_videos ADD CONSTRAINT FK_acc_vi FOREIGN KEY (userIdOwner) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE SET NULL
;
-- ***************************
-- * change engine to InnoDB *
-- * unify userId-fields *
-- ***************************

ALTER TABLE `aowow_account`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT;

ALTER TABLE `aowow_account_banned`
ALTER `userId` DROP DEFAULT,
ALTER `staffId` DROP DEFAULT;
ALTER TABLE `aowow_account_banned`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `userId` `userId` INT(10) UNSIGNED NOT NULL COMMENT 'affected accountId' AFTER `id`,
CHANGE COLUMN `staffId` `staffId` INT(10) UNSIGNED NOT NULL COMMENT 'executive accountId' AFTER `userId`;

ALTER TABLE `aowow_account_cookies`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT;

ALTER TABLE `aowow_account_reputation`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT;

ALTER TABLE `aowow_account_weightscales`
ALTER `account` DROP DEFAULT;
ALTER TABLE `aowow_account_weightscales`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `account` `userId` INT(10) UNSIGNED NOT NULL AFTER `id`;

ALTER TABLE `aowow_screenshots`
ALTER `uploader` DROP DEFAULT;
ALTER TABLE `aowow_screenshots`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `uploader` `userIdOwner` INT(10) UNSIGNED NULL AFTER `typeId`,
CHANGE COLUMN `approvedBy` `userIdApprove` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `status`,
CHANGE COLUMN `deletedBy` `userIdDelete` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `userIdApprove`;

ALTER TABLE `aowow_videos`
ALTER `uploader` DROP DEFAULT;
ALTER TABLE `aowow_videos`
ENGINE=InnoDB,
ROW_FORMAT=COMPACT,
CHANGE COLUMN `uploader` `userIdOwner` INT(10) UNSIGNED NULL AFTER `typeId`,
CHANGE COLUMN `approvedBy` `userIdApprove` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `status`,
ADD COLUMN `userIdeDelete` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `userIdApprove`;

-- **********************
-- * apply foreign keys *
-- **********************

ALTER TABLE aowow_account_cookies ADD CONSTRAINT FK_acc_cookies FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_account_banned ADD CONSTRAINT FK_acc_banned FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_account_reputation ADD CONSTRAINT FK_acc_rep FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_account_weightscales ADD CONSTRAINT FK_acc_weights FOREIGN KEY (userId) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE CASCADE
;
ALTER TABLE aowow_screenshots ADD CONSTRAINT FK_acc_ss FOREIGN KEY (userIdOwner) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE SET NULL
;
ALTER TABLE aowow_videos ADD CONSTRAINT FK_acc_vi FOREIGN KEY (userIdOwner) REFERENCES aowow_account(id)
ON UPDATE CASCADE
ON DELETE SET NULL
;
@@ -1,2 +1,2 @@
INSERT IGNORE INTO aowow_config (`key`, `value`, `flags`, `comment`) VALUES
('memory_limit', '2048M', 0xC8, 'default: 2048M - parsing spell.dbc is quite intense');
INSERT IGNORE INTO aowow_config (`key`, `value`, `flags`, `comment`) VALUES
('memory_limit', '2048M', 0xC8, 'default: 2048M - parsing spell.dbc is quite intense');
@@ -1,15 +1,15 @@
ALTER TABLE `aowow_config`
ADD COLUMN `cat` TINYINT(3) UNSIGNED NOT NULL DEFAULT '5' AFTER `value`;

INSERT IGNORE INTO `aowow_config` (`key`, `value`, `cat`, `flags`, `comment`) VALUES
('cache_dir', '', 1, 136, 'default: cache/template - generated pages are saved here (requires CACHE_MODE: filecache)'),
('session.gc_maxlifetime', '604800', 3, 200, 'default: 7*24*60*60 - lifetime of session data'),
('session.gc_probability', '0', 3, 200, 'default: 0 - probability to remove session data on garbage collection'),
('session_cache_dir', '', 3, 136, 'default: - php sessions are saved here. Leave empty to use php default directory.');

UPDATE `aowow_config` SET `key` = 'acc_failed_auth_block' WHERE `key` = 'failed_auth_exclusion';
UPDATE `aowow_config` SET `key` = 'acc_failed_auth_count' WHERE `key` = 'failed_auth_count';
UPDATE `aowow_config` SET `key` = 'acc_allow_register' WHERE `key` = 'allow_register';
UPDATE `aowow_config` SET `key` = 'acc_auth_mode' WHERE `key` = 'auth_mode';
UPDATE `aowow_config` SET `key` = 'acc_create_save_decay' WHERE `key` = 'account_create_save_decay';
UPDATE `aowow_config` SET `key` = 'acc_recovery_decay' WHERE `key` = 'account_recovery_decay';
ALTER TABLE `aowow_config`
ADD COLUMN `cat` TINYINT(3) UNSIGNED NOT NULL DEFAULT '5' AFTER `value`;

INSERT IGNORE INTO `aowow_config` (`key`, `value`, `cat`, `flags`, `comment`) VALUES
('cache_dir', '', 1, 136, 'default: cache/template - generated pages are saved here (requires CACHE_MODE: filecache)'),
('session.gc_maxlifetime', '604800', 3, 200, 'default: 7*24*60*60 - lifetime of session data'),
('session.gc_probability', '0', 3, 200, 'default: 0 - probability to remove session data on garbage collection'),
('session_cache_dir', '', 3, 136, 'default: - php sessions are saved here. Leave empty to use php default directory.');

UPDATE `aowow_config` SET `key` = 'acc_failed_auth_block' WHERE `key` = 'failed_auth_exclusion';
UPDATE `aowow_config` SET `key` = 'acc_failed_auth_count' WHERE `key` = 'failed_auth_count';
UPDATE `aowow_config` SET `key` = 'acc_allow_register' WHERE `key` = 'allow_register';
UPDATE `aowow_config` SET `key` = 'acc_auth_mode' WHERE `key` = 'auth_mode';
UPDATE `aowow_config` SET `key` = 'acc_create_save_decay' WHERE `key` = 'account_create_save_decay';
UPDATE `aowow_config` SET `key` = 'acc_recovery_decay' WHERE `key` = 'account_recovery_decay';
@@ -1,5 +1,5 @@
ALTER TABLE `aowow_currencies`
ADD COLUMN `cap` MEDIUMINT UNSIGNED NOT NULL AFTER `itemId`;

UPDATE `aowow_currencies` SET `cap` = 10000 WHERE `id` = 103;
UPDATE `aowow_currencies` SET `cap` = 75000 WHERE `id` = 104;
ALTER TABLE `aowow_currencies`
ADD COLUMN `cap` MEDIUMINT UNSIGNED NOT NULL AFTER `itemId`;

UPDATE `aowow_currencies` SET `cap` = 10000 WHERE `id` = 103;
UPDATE `aowow_currencies` SET `cap` = 75000 WHERE `id` = 104;
@@ -1 +1 @@
INSERT IGNORE INTO `aowow_config` (`key`, `value`, `flags`, `comment`) VALUES ('default_charset', 'UTF-8', 72, 'default: UTF-8');
INSERT IGNORE INTO `aowow_config` (`key`, `value`, `flags`, `comment`) VALUES ('default_charset', 'UTF-8', 72, 'default: UTF-8');
@@ -1,58 +1,58 @@
ALTER TABLE `aowow_items`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_items`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `itemLimitCategory`;

ALTER TABLE `aowow_itemset`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_itemset`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `contentGroup`;

ALTER TABLE `aowow_quests`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_quests`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `timeLimit`;

ALTER TABLE `aowow_titles`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_titles`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `src12Ext`;

ALTER TABLE `aowow_comments`
ALTER `typeId` DROP DEFAULT;
ALTER TABLE `aowow_comments`
CHANGE COLUMN `typeId` `typeId` INT(10) NOT NULL COMMENT 'ID Of Page' AFTER `type`;

-- ---------------
-- try to reconstruct CommunityContent for TYPE_WORLDEVENT (12)
-- ---------------
UPDATE `aowow_comments` c, `aowow_events` e SET c.`typeId` = e.`id` WHERE c.`type` = 12 AND c.`typeId` > 0 AND c.`typeId` = e.`holidayId`;
UPDATE `aowow_comments` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
UPDATE `aowow_screenshots` s, `aowow_events` e SET s.`typeId` = e.`id` WHERE s.`type` = 12 AND s.`typeId` > 0 AND s.`typeId` = e.`holidayId`;
UPDATE `aowow_screenshots` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
UPDATE `aowow_videos` v, `aowow_events` e SET v.`typeId` = e.`id` WHERE v.`type` = 12 AND v.`typeId` > 0 AND v.`typeId` = e.`holidayId`;
UPDATE `aowow_videos` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;

-- ---------------
-- drop not recoverable comments
-- ---------------
DELETE FROM `aowow_account_reputation` WHERE `action` IN (3, 4, 5) AND `sourceA` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)

DELETE FROM `aowow_comments_rates` WHERE `commentId` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)

DELETE FROM `aowow_comments` WHERE `id` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)
ALTER TABLE `aowow_items`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_items`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `itemLimitCategory`;

ALTER TABLE `aowow_itemset`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_itemset`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `contentGroup`;

ALTER TABLE `aowow_quests`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_quests`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `timeLimit`;

ALTER TABLE `aowow_titles`
ALTER `holidayId` DROP DEFAULT;
ALTER TABLE `aowow_titles`
CHANGE COLUMN `holidayId` `eventId` SMALLINT(5) UNSIGNED NOT NULL AFTER `src12Ext`;

ALTER TABLE `aowow_comments`
ALTER `typeId` DROP DEFAULT;
ALTER TABLE `aowow_comments`
CHANGE COLUMN `typeId` `typeId` INT(10) NOT NULL COMMENT 'ID Of Page' AFTER `type`;

-- ---------------
-- try to reconstruct CommunityContent for TYPE_WORLDEVENT (12)
-- ---------------
UPDATE `aowow_comments` c, `aowow_events` e SET c.`typeId` = e.`id` WHERE c.`type` = 12 AND c.`typeId` > 0 AND c.`typeId` = e.`holidayId`;
UPDATE `aowow_comments` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
UPDATE `aowow_screenshots` s, `aowow_events` e SET s.`typeId` = e.`id` WHERE s.`type` = 12 AND s.`typeId` > 0 AND s.`typeId` = e.`holidayId`;
UPDATE `aowow_screenshots` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;
UPDATE `aowow_videos` v, `aowow_events` e SET v.`typeId` = e.`id` WHERE v.`type` = 12 AND v.`typeId` > 0 AND v.`typeId` = e.`holidayId`;
UPDATE `aowow_videos` SET `typeId` = -`typeId` WHERE `type` = 12 AND `typeId` < 0;

-- ---------------
-- drop not recoverable comments
-- ---------------
DELETE FROM `aowow_account_reputation` WHERE `action` IN (3, 4, 5) AND `sourceA` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)

DELETE FROM `aowow_comments_rates` WHERE `commentId` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)

DELETE FROM `aowow_comments` WHERE `id` IN (
SELECT x.`id` FROM (
SELECT c2.id FROM `aowow_comments` c1 JOIN `aowow_comments` c2 ON c2.`replyTo` = c1.`id` WHERE c1.`type` = 12 AND c1.`typeId` = 0 UNION
SELECT id FROM `aowow_comments` WHERE `type` = 12 AND `typeId` = 0
) AS x
)

0 comments on commit f9416c5

Please sign in to comment.
You can’t perform that action at this time.