Skip to content

Commit

Permalink
Profiler/Chars
Browse files Browse the repository at this point in the history
 * prefix characters flagged for rename to prevent collision with real char names (multiple chars flagged for rename will still collide, but what the hoo haa)
 * alter table index to prevent creation and subsequent conflict with duplicate entries of the same char (realm/guid pair)
  • Loading branch information
Sarjuuk committed May 26, 2018
1 parent 7dc283f commit c5d28a9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions includes/profiler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@ public static function getCharFromRealm($realmId, $charGuid)
'achievementpoints' => 0
);

// char is flagged for rename
if ($char['at_login'] & 0x1)
$data['name'] = 'RENAME-'.$data['name'];

/********************/
/* talents + glyphs */
Expand Down
4 changes: 4 additions & 0 deletions includes/types/profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ public function __construct($conditions = [], $miscData = null)
$distrib[$curTpl['realm']]++;
}

// char is pending rename
if ($curTpl['at_login'] & 0x1)
$curTpl['name'] = 'RENAME-'.$curTpl['name'];

$curTpl['cuFlags'] = 0;
}

Expand Down
4 changes: 2 additions & 2 deletions setup/db_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1886,7 +1886,7 @@ CREATE TABLE `aowow_profiler_profiles` (
`glyphs2` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL,
`activespec` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `realm_realmGUID_name` (`realm`,`realmGUID`,`name`),
UNIQUE KEY `realm_realmGUID` (`realm`,`realmGUID`),
KEY `user` (`user`),
KEY `guild` (`guild`),
CONSTRAINT `FK_aowow_profiler_profiles_aowow_profiler_guild` FOREIGN KEY (`guild`) REFERENCES `aowow_profiler_guild` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
Expand Down Expand Up @@ -3090,7 +3090,7 @@ UNLOCK TABLES;

LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1525094405,0,NULL,NULL);
INSERT INTO `aowow_dbversion` VALUES (1527333496,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
8 changes: 8 additions & 0 deletions setup/updates/1527333495_01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- clear synced chars to prevent conflicts
DELETE FROM `aowow_profiler_profiles` WHERE `realmGUID` IS NOT NULL;
-- clear queue
DELETE FROM `aowow_profiler_sync`;
-- update unique index
ALTER TABLE `aowow_profiler_profiles`
DROP INDEX `realm_realmGUID_name`,
ADD UNIQUE INDEX `realm_realmGUID` (`realm`, `realmGUID`);

0 comments on commit c5d28a9

Please sign in to comment.