Fix char db

This commit is contained in:
luis
2026-10-08 17:19:55 -03:00
parent d25f3854a7
commit e3fc13625a
@@ -0,0 +1,481 @@
-- Housing reset: drop and recreate every character-DB housing system table from scratch.
-- Schema generated from the live character database (Gexo91 housing feature set).
--
-- WARNING: destructive. All existing housing data (houses, rooms, decor, catalog,
-- neighborhoods, members, charters, initiatives) is deleted.
--
-- Covers: account_housing_* / character_housing* / neighborhoods /
-- neighborhood_* (charters, invites, members, initiatives) / housing_initiative_*.
-- Excludes the legacy rp_housing_legacy_* and rp_housing_migration tables.
SET FOREIGN_KEY_CHECKS=0;
SET NAMES utf8mb4;
DROP TABLE IF EXISTS `account_housing_blueprint`;
CREATE TABLE `account_housing_blueprint` (
`id` bigint unsigned NOT NULL,
`uuid` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`bnetAccountId` int unsigned NOT NULL,
`exporterGuid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Character that exported it',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`type` tinyint unsigned NOT NULL COMMENT 'HousingBlueprintType: 1 House, 2 Room, 3 Interior, 4 Exterior',
`flags` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'HousingBlueprintFlag: 1 AutomaticBackup',
`createTime` bigint NOT NULL DEFAULT '0',
`content` mediumblob NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_uuid` (`uuid`),
KEY `idx_bnetAccountId` (`bnetAccountId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `account_housing_house_type`;
CREATE TABLE `account_housing_house_type` (
`bnetAccountId` int unsigned NOT NULL,
`houseExteriorWmoDataId` int unsigned NOT NULL COMMENT 'HouseExteriorWmoData.db2 ID unlocked for the account (item facades)',
PRIMARY KEY (`bnetAccountId`,`houseExteriorWmoDataId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `account_housing_room`;
CREATE TABLE `account_housing_room` (
`bnetAccountId` int unsigned NOT NULL,
`roomId` int unsigned NOT NULL COMMENT 'HouseRoom.db2 ID unlocked for the account (level award rooms)',
PRIMARY KEY (`bnetAccountId`,`roomId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `character_housing`;
CREATE TABLE `character_housing` (
`guid` bigint unsigned NOT NULL COMMENT 'Player GUID',
`houseId` int unsigned NOT NULL DEFAULT '0' COMMENT 'House DB2 entry ID',
`neighborhoodGuid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'FK to neighborhoods.guid',
`plotIndex` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Plot within neighborhood (0..MAX_NEIGHBORHOOD_PLOTS-1)',
`houseLevel` int unsigned NOT NULL DEFAULT '1' COMMENT 'Current upgrade level',
`favor` int unsigned NOT NULL DEFAULT '0' COMMENT 'Accumulated favor currency',
`settingsFlags` int unsigned NOT NULL DEFAULT '0' COMMENT 'Bitmask of HouseSettingsFlags',
`exteriorLocked` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Whether exterior editing is locked (1=locked, 0=unlocked)',
`houseSize` tinyint unsigned NOT NULL DEFAULT '2' COMMENT 'HousingFixtureSize: 1=Any, 2=Small, 3=Medium, 4=Large',
`houseType` int unsigned NOT NULL DEFAULT '0' COMMENT 'HouseExteriorWmoData DB2 entry ID (architectural style)',
`createTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp of house creation',
`posX` float NOT NULL DEFAULT '0' COMMENT 'House X position on plot',
`posY` float NOT NULL DEFAULT '0' COMMENT 'House Y position on plot',
`posZ` float NOT NULL DEFAULT '0' COMMENT 'House Z position on plot',
`facing` float NOT NULL DEFAULT '0' COMMENT 'House facing angle on plot',
`houseName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Player-set house display name',
`houseDescription` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Player-set house description',
PRIMARY KEY (`guid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
DROP TABLE IF EXISTS `character_housing_catalog`;
CREATE TABLE `character_housing_catalog` (
`ownerGuid` int NOT NULL DEFAULT '0',
`houseDecorId` int unsigned NOT NULL COMMENT 'HouseDecor DB2 entry ID',
`quantity` decimal(54,0) DEFAULT NULL,
`sourceType` tinyint unsigned DEFAULT NULL COMMENT 'DecorSourceType: 0=Standard, 3=Deferred, 5=Spell, 6=Item',
`sourceValue` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Source context (spell ID, item GUID, etc.)',
PRIMARY KEY (`ownerGuid`,`houseDecorId`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
DROP TABLE IF EXISTS `character_housing_decor`;
CREATE TABLE `character_housing_decor` (
`ownerGuid` bigint unsigned NOT NULL COMMENT 'FK to character_housing.guid',
`id` bigint unsigned NOT NULL COMMENT 'Decor instance ID (unique per owner)',
`houseDecorId` int unsigned NOT NULL COMMENT 'HouseDecor DB2 entry ID',
`posX` float NOT NULL DEFAULT '0' COMMENT 'X position in room/house coordinates',
`posY` float NOT NULL DEFAULT '0' COMMENT 'Y position in room/house coordinates',
`posZ` float NOT NULL DEFAULT '0' COMMENT 'Z position in room/house coordinates',
`rotX` float NOT NULL DEFAULT '0' COMMENT 'Quaternion rotation X component',
`rotY` float NOT NULL DEFAULT '0' COMMENT 'Quaternion rotation Y component',
`rotZ` float NOT NULL DEFAULT '0' COMMENT 'Quaternion rotation Z component',
`rotW` float NOT NULL DEFAULT '1' COMMENT 'Quaternion rotation W component',
`scale` float NOT NULL DEFAULT '1',
`dyeSlot0` int unsigned NOT NULL DEFAULT '0' COMMENT 'Dye color ID for slot 0',
`dyeSlot1` int unsigned NOT NULL DEFAULT '0' COMMENT 'Dye color ID for slot 1',
`dyeSlot2` int unsigned NOT NULL DEFAULT '0' COMMENT 'Dye color ID for slot 2',
`roomGuid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'FK to character_housing_rooms.id (0 = outdoor/unassigned)',
`locked` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Whether the decor item is locked in place (1=locked, 0=unlocked)',
`placementTime` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when decor was placed (for refund window)',
`sourceType` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'DecorSourceType: 0=Standard, 3=Deferred, 5=Spell, 6=Item',
`sourceValue` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Source context (spell ID, item GUID, etc.)',
`petGuid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Battle pet counter bound to this decor slot (0 = none), HighGuid::BattlePet',
`petFlag` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Client-sent flag accompanying the pet binding (CMSG_HOUSING_DECOR_SET_PET)',
`parentDecorGuid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Counter of the decor this item is stacked on (0 = none)',
PRIMARY KEY (`ownerGuid`,`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
DROP TABLE IF EXISTS `character_housing_fixtures`;
CREATE TABLE `character_housing_fixtures` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique fixture assignment ID',
`ownerGuid` bigint unsigned NOT NULL COMMENT 'FK to character_housing.guid',
`fixturePointId` int unsigned NOT NULL COMMENT 'Predefined fixture point identifier',
`fixtureOptionId` int unsigned NOT NULL DEFAULT '0' COMMENT 'Selected fixture option (0 = default)',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_owner` (`ownerGuid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
DROP TABLE IF EXISTS `character_housing_ignored_neighborhood`;
CREATE TABLE `character_housing_ignored_neighborhood` (
`ownerGuid` bigint unsigned NOT NULL COMMENT 'Player character GUID counter',
`neighborhoodGuid` bigint unsigned NOT NULL COMMENT 'Ignored neighborhood GUID counter',
PRIMARY KEY (`ownerGuid`,`neighborhoodGuid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
DROP TABLE IF EXISTS `character_housing_rooms`;
CREATE TABLE `character_housing_rooms` (
`ownerGuid` bigint unsigned NOT NULL COMMENT 'FK to character_housing.guid',
`id` bigint unsigned NOT NULL COMMENT 'Room instance ID (unique per owner)',
`houseRoomId` int unsigned NOT NULL COMMENT 'HouseRoom DB2 entry ID',
`slotIndex` int unsigned NOT NULL DEFAULT '0' COMMENT 'Room slot within the house layout',
`gridX` int NOT NULL DEFAULT '0',
`gridY` int NOT NULL DEFAULT '0',
`floorIndex` int NOT NULL DEFAULT '0',
`orientation` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Room rotation orientation value',
`mirrored` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Boolean: 1 = room layout is mirrored',
`themeId` int unsigned NOT NULL DEFAULT '0' COMMENT 'Visual theme applied to the room',
`wallTextureId` int unsigned NOT NULL DEFAULT '0' COMMENT 'RoomComponentTexture ID for walls',
`floorTextureId` int unsigned NOT NULL DEFAULT '0' COMMENT 'RoomComponentTexture ID for floors',
`ceilingTextureId` int unsigned NOT NULL DEFAULT '0' COMMENT 'RoomComponentTexture ID for ceilings',
`colorOverride` int NOT NULL DEFAULT '-1' COMMENT 'Color override for materials (-1 = default)',
`doorTypeId` int unsigned NOT NULL DEFAULT '0' COMMENT 'Door type for the room',
`doorSlot` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Door slot index within the room',
`ceilingTypeId` int unsigned NOT NULL DEFAULT '0' COMMENT 'Ceiling type for the room',
`ceilingSlot` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Ceiling slot index within the room',
`wallThemeId` int unsigned NOT NULL DEFAULT '0',
`floorThemeId` int unsigned NOT NULL DEFAULT '0',
`ceilingThemeId` int unsigned NOT NULL DEFAULT '0',
`doorTypes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`componentStyles` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`ownerGuid`,`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
DROP TABLE IF EXISTS `housing_initiative_activity_definition`;
CREATE TABLE `housing_initiative_activity_definition` (
`InitiativeID` int unsigned NOT NULL,
`ActivityID` int unsigned NOT NULL,
`CriteriaID` bigint unsigned NOT NULL DEFAULT '0',
`Target` bigint unsigned NOT NULL DEFAULT '0',
`Enabled` tinyint unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`InitiativeID`,`ActivityID`),
KEY `idx_housing_initiative_activity_criteria` (`CriteriaID`),
KEY `idx_housing_initiative_activity_enabled` (`InitiativeID`,`Enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_activity_history`;
CREATE TABLE `housing_initiative_activity_history` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`GenerationID` bigint unsigned NOT NULL,
`ActivityID` int unsigned NOT NULL,
`Progress` bigint unsigned NOT NULL DEFAULT '0',
`Target` bigint unsigned NOT NULL DEFAULT '0',
`Completed` tinyint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`NeighborhoodGuid`,`GenerationID`,`ActivityID`),
KEY `idx_housing_initiative_activity_history_activity` (`ActivityID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_activity_log`;
CREATE TABLE `housing_initiative_activity_log` (
`ID` bigint unsigned NOT NULL AUTO_INCREMENT,
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`CharacterGuid` bigint unsigned NOT NULL DEFAULT '0',
`ActivityID` int unsigned NOT NULL DEFAULT '0',
`ProgressDelta` bigint NOT NULL DEFAULT '0',
`CreatedAt` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
KEY `idx_housing_initiative_log_neighborhood` (`NeighborhoodGuid`,`ID`),
KEY `idx_housing_initiative_log_character` (`CharacterGuid`,`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_activity_log_history`;
CREATE TABLE `housing_initiative_activity_log_history` (
`ArchiveID` bigint unsigned NOT NULL AUTO_INCREMENT,
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`GenerationID` bigint unsigned NOT NULL,
`CharacterGuid` bigint unsigned NOT NULL DEFAULT '0',
`ActivityID` int unsigned NOT NULL DEFAULT '0',
`ProgressDelta` bigint NOT NULL DEFAULT '0',
`CreatedAt` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`ArchiveID`),
KEY `idx_housing_initiative_log_history_generation` (`NeighborhoodGuid`,`GenerationID`,`ArchiveID`),
KEY `idx_housing_initiative_log_history_character` (`CharacterGuid`,`GenerationID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_activity_progress`;
CREATE TABLE `housing_initiative_activity_progress` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`ActivityID` int unsigned NOT NULL,
`Progress` bigint unsigned NOT NULL DEFAULT '0',
`Target` bigint unsigned NOT NULL DEFAULT '0',
`Completed` tinyint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`,`ActivityID`),
KEY `idx_housing_initiative_activity` (`ActivityID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_completion`;
CREATE TABLE `housing_initiative_completion` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`InitiativeID` int unsigned NOT NULL,
`CompletedAt` bigint unsigned NOT NULL DEFAULT '0',
`RewardAvailable` tinyint unsigned NOT NULL DEFAULT '0',
`RewardClaimed` tinyint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`NeighborhoodGuid`,`InitiativeID`),
KEY `idx_housing_initiative_completion_reward` (`RewardAvailable`,`RewardClaimed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_criteria_checkpoint`;
CREATE TABLE `housing_initiative_criteria_checkpoint` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`InitiativeID` int unsigned NOT NULL,
`CharacterGuid` bigint unsigned NOT NULL,
`CriteriaID` int unsigned NOT NULL,
`ActivityID` int unsigned NOT NULL,
`LastCounter` bigint unsigned NOT NULL DEFAULT '0',
`LastMemberProgress` bigint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`,`InitiativeID`,`CharacterGuid`,`CriteriaID`),
KEY `idx_housing_initiative_criteria_character` (`CharacterGuid`,`CriteriaID`),
KEY `idx_housing_initiative_criteria_activity` (`InitiativeID`,`ActivityID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_expiration`;
CREATE TABLE `housing_initiative_expiration` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`InitiativeID` int unsigned NOT NULL,
`ExpiredAt` bigint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`,`InitiativeID`),
KEY `idx_housing_initiative_expiration_time` (`ExpiredAt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_history`;
CREATE TABLE `housing_initiative_history` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`GenerationID` bigint unsigned NOT NULL,
`ScheduleID` bigint unsigned NOT NULL DEFAULT '0',
`InitiativeID` int unsigned NOT NULL,
`State` tinyint unsigned NOT NULL DEFAULT '0',
`Progress` bigint unsigned NOT NULL DEFAULT '0',
`RewardTier` smallint unsigned NOT NULL DEFAULT '0',
`StartedAt` bigint unsigned NOT NULL DEFAULT '0',
`EndsAt` bigint unsigned NOT NULL DEFAULT '0',
`CompletedAt` bigint unsigned NOT NULL DEFAULT '0',
`ExpiredAt` bigint unsigned NOT NULL DEFAULT '0',
`RewardAvailable` tinyint unsigned NOT NULL DEFAULT '0',
`RewardClaimed` tinyint unsigned NOT NULL DEFAULT '0',
`ArchivedAt` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`NeighborhoodGuid`,`GenerationID`),
KEY `idx_housing_initiative_history_initiative` (`InitiativeID`,`ArchivedAt`),
KEY `idx_housing_initiative_history_reward` (`RewardAvailable`,`RewardClaimed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_member_history`;
CREATE TABLE `housing_initiative_member_history` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`GenerationID` bigint unsigned NOT NULL,
`CharacterGuid` bigint unsigned NOT NULL,
`ActivityID` int unsigned NOT NULL,
`Progress` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`NeighborhoodGuid`,`GenerationID`,`CharacterGuid`,`ActivityID`),
KEY `idx_housing_initiative_member_history_character` (`CharacterGuid`,`GenerationID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_member_progress`;
CREATE TABLE `housing_initiative_member_progress` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`CharacterGuid` bigint unsigned NOT NULL,
`ActivityID` int unsigned NOT NULL,
`Progress` bigint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`,`CharacterGuid`,`ActivityID`),
KEY `idx_housing_initiative_member_activity` (`ActivityID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_player_state`;
CREATE TABLE `housing_initiative_player_state` (
`CharacterGuid` bigint unsigned NOT NULL,
`ActiveNeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`CharacterGuid`),
KEY `idx_housing_initiative_active_neighborhood` (`ActiveNeighborhoodGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_progress_generation`;
CREATE TABLE `housing_initiative_progress_generation` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`InitiativeID` int unsigned NOT NULL DEFAULT '0',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_reward_catalog`;
CREATE TABLE `housing_initiative_reward_catalog` (
`RewardTier` smallint unsigned NOT NULL,
`EntryID` int unsigned NOT NULL,
`GrantType` tinyint unsigned NOT NULL,
`AssetID` int unsigned NOT NULL,
`Quantity` int unsigned NOT NULL,
`Enabled` tinyint unsigned NOT NULL DEFAULT '1',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`RewardTier`,`EntryID`),
KEY `idx_housing_initiative_reward_catalog_enabled` (`RewardTier`,`Enabled`,`EntryID`),
KEY `idx_housing_initiative_reward_catalog_asset` (`GrantType`,`AssetID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_reward_claim`;
CREATE TABLE `housing_initiative_reward_claim` (
`ClaimID` bigint unsigned NOT NULL AUTO_INCREMENT,
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`GenerationID` bigint unsigned NOT NULL,
`InitiativeID` int unsigned NOT NULL,
`CharacterGuid` bigint unsigned NOT NULL,
`State` tinyint unsigned NOT NULL DEFAULT '0',
`CreatedAt` bigint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` bigint unsigned NOT NULL DEFAULT '0',
`CompletedAt` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`ClaimID`),
UNIQUE KEY `uq_housing_initiative_reward_generation` (`NeighborhoodGuid`,`GenerationID`),
KEY `idx_housing_initiative_reward_claimant` (`CharacterGuid`,`State`,`ClaimID`),
KEY `idx_housing_initiative_reward_initiative` (`InitiativeID`,`State`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_reward_delivery`;
CREATE TABLE `housing_initiative_reward_delivery` (
`ClaimID` bigint unsigned NOT NULL,
`EntryID` int unsigned NOT NULL,
`GrantType` tinyint unsigned NOT NULL,
`AssetID` int unsigned NOT NULL,
`Quantity` int unsigned NOT NULL,
`State` tinyint unsigned NOT NULL DEFAULT '0',
`CreatedAt` bigint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` bigint unsigned NOT NULL DEFAULT '0',
`DeliveredAt` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`ClaimID`,`EntryID`),
KEY `idx_housing_initiative_reward_delivery_state` (`State`,`ClaimID`),
KEY `idx_housing_initiative_reward_delivery_asset` (`GrantType`,`AssetID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_reward_execution`;
CREATE TABLE `housing_initiative_reward_execution` (
`ClaimID` bigint unsigned NOT NULL,
`EntryID` int unsigned NOT NULL,
`GrantType` tinyint unsigned NOT NULL,
`AssetID` int unsigned NOT NULL,
`Quantity` int unsigned NOT NULL,
`State` tinyint unsigned NOT NULL DEFAULT '0',
`ObservedBefore` bigint unsigned NOT NULL DEFAULT '0',
`ExpectedAfter` bigint unsigned NOT NULL DEFAULT '0',
`ObservedAfter` bigint unsigned NOT NULL DEFAULT '0',
`StartedAt` bigint unsigned NOT NULL DEFAULT '0',
`UpdatedAt` bigint unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`ClaimID`,`EntryID`),
KEY `idx_housing_initiative_reward_execution_state` (`State`,`ClaimID`),
KEY `idx_housing_initiative_reward_execution_asset` (`GrantType`,`AssetID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_rotation_state`;
CREATE TABLE `housing_initiative_rotation_state` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`GenerationID` bigint unsigned NOT NULL DEFAULT '0',
`ActiveScheduleID` bigint unsigned NOT NULL DEFAULT '0',
`InitiativeID` int unsigned NOT NULL DEFAULT '0',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`),
KEY `idx_housing_initiative_rotation_schedule` (`ActiveScheduleID`),
KEY `idx_housing_initiative_rotation_initiative` (`InitiativeID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_initiative_schedule`;
CREATE TABLE `housing_initiative_schedule` (
`ScheduleID` bigint unsigned NOT NULL AUTO_INCREMENT,
`InitiativeID` int unsigned NOT NULL,
`RewardTier` smallint unsigned NOT NULL DEFAULT '0',
`StartsAt` bigint unsigned NOT NULL,
`EndsAt` bigint unsigned NOT NULL DEFAULT '0',
`Enabled` tinyint unsigned NOT NULL DEFAULT '1',
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ScheduleID`),
KEY `idx_housing_initiative_schedule_window` (`Enabled`,`StartsAt`,`EndsAt`),
KEY `idx_housing_initiative_schedule_initiative` (`InitiativeID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `housing_neighborhood_initiative`;
CREATE TABLE `housing_neighborhood_initiative` (
`NeighborhoodGuid` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`InitiativeID` int unsigned NOT NULL DEFAULT '0',
`State` tinyint unsigned NOT NULL DEFAULT '0',
`Progress` bigint unsigned NOT NULL DEFAULT '0',
`RewardTier` smallint unsigned NOT NULL DEFAULT '0',
`StartedAt` bigint unsigned DEFAULT NULL,
`EndsAt` bigint unsigned DEFAULT NULL,
`UpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`NeighborhoodGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_charter_signatures`;
CREATE TABLE `neighborhood_charter_signatures` (
`charterId` bigint unsigned NOT NULL COMMENT 'FK to neighborhood_charters.id',
`signerGuid` bigint unsigned NOT NULL COMMENT 'Player GUID of the signer',
`signTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when the signature was made',
PRIMARY KEY (`charterId`,`signerGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_charters`;
CREATE TABLE `neighborhood_charters` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique charter ID',
`creatorGuid` bigint unsigned NOT NULL COMMENT 'Player GUID of the charter creator',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Proposed neighborhood name (max HOUSING_MAX_NAME_LENGTH)',
`neighborhoodMapId` int unsigned NOT NULL COMMENT 'NeighborhoodMap DB2 entry ID for the target map',
`factionFlags` int unsigned NOT NULL DEFAULT '0' COMMENT 'Faction restriction flags for the neighborhood',
`isGuild` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Boolean: 1 = guild-associated neighborhood',
`createTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp of charter creation',
PRIMARY KEY (`id`),
KEY `idx_creator` (`creatorGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_initiative_contributions`;
CREATE TABLE `neighborhood_initiative_contributions` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`initiativeDbId` bigint unsigned NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
`playerGuid` bigint unsigned NOT NULL COMMENT 'Player character GUID',
`taskId` int unsigned NOT NULL COMMENT 'InitiativeTask DB2 entry ID',
`amount` int unsigned NOT NULL DEFAULT '0' COMMENT 'Cumulative contribution to this task',
`lastUpdated` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp of last contribution',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_initiative_player_task` (`initiativeDbId`,`playerGuid`,`taskId`),
KEY `idx_player` (`playerGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_initiative_milestones`;
CREATE TABLE `neighborhood_initiative_milestones` (
`initiativeDbId` bigint unsigned NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
`milestoneIndex` int unsigned NOT NULL COMMENT 'Milestone index (0, 1, 2)',
`reached` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '1 = milestone has been reached',
`reachedTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when milestone was reached',
PRIMARY KEY (`initiativeDbId`,`milestoneIndex`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_initiative_reward_claims`;
CREATE TABLE `neighborhood_initiative_reward_claims` (
`initiativeDbId` bigint unsigned NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
`milestoneIndex` int unsigned NOT NULL COMMENT 'Milestone index (0, 1, 2)',
`playerGuid` bigint unsigned NOT NULL COMMENT 'Player character GUID',
`claimTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when reward was claimed',
PRIMARY KEY (`initiativeDbId`,`milestoneIndex`,`playerGuid`),
KEY `idx_player` (`playerGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_initiative_task_progress`;
CREATE TABLE `neighborhood_initiative_task_progress` (
`initiativeDbId` bigint unsigned NOT NULL COMMENT 'FK to neighborhood_initiatives.id',
`taskId` int unsigned NOT NULL COMMENT 'InitiativeTask DB2 entry ID',
`progress` int unsigned NOT NULL DEFAULT '0' COMMENT 'Current progress count towards TargetCount',
`status` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '0=NOT_STARTED, 1=IN_PROGRESS, 2=COMPLETE',
PRIMARY KEY (`initiativeDbId`,`taskId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_initiatives`;
CREATE TABLE `neighborhood_initiatives` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique initiative instance ID',
`neighborhoodGuid` bigint unsigned NOT NULL COMMENT 'FK to neighborhoods.guid',
`initiativeId` int unsigned NOT NULL COMMENT 'NeighborhoodInitiative DB2 entry ID',
`startTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when the initiative began',
`progress` float NOT NULL DEFAULT '0' COMMENT 'Completion progress (0.0 to 1.0)',
`completed` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Boolean: 1 = initiative completed',
PRIMARY KEY (`id`),
KEY `idx_neighborhood` (`neighborhoodGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_invites`;
CREATE TABLE `neighborhood_invites` (
`neighborhoodGuid` bigint unsigned NOT NULL COMMENT 'FK to neighborhoods.guid',
`inviteeGuid` bigint unsigned NOT NULL COMMENT 'Player GUID of the invited player',
`inviterGuid` bigint unsigned NOT NULL COMMENT 'Player GUID of the player who sent the invite',
`inviteTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when the invite was sent',
PRIMARY KEY (`neighborhoodGuid`,`inviteeGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhood_members`;
CREATE TABLE `neighborhood_members` (
`neighborhoodGuid` bigint unsigned NOT NULL COMMENT 'FK to neighborhoods.guid',
`playerGuid` bigint unsigned NOT NULL COMMENT 'Player GUID of the member',
`role` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'NeighborhoodMemberRole: 0=Resident, 1=Manager, 2=Owner',
`joinTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp when the player joined',
`plotIndex` tinyint unsigned NOT NULL DEFAULT '255' COMMENT 'Assigned plot index (255 = INVALID_PLOT_INDEX, no plot)',
PRIMARY KEY (`neighborhoodGuid`,`playerGuid`),
KEY `idx_player` (`playerGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `neighborhoods`;
CREATE TABLE `neighborhoods` (
`guid` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique neighborhood instance ID',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Neighborhood display name (max HOUSING_MAX_NAME_LENGTH)',
`neighborhoodMapId` int unsigned NOT NULL COMMENT 'NeighborhoodMap DB2 entry ID',
`ownerGuid` bigint unsigned NOT NULL COMMENT 'Player GUID of the neighborhood founder/owner',
`factionRestriction` int NOT NULL DEFAULT '0' COMMENT 'NeighborhoodFactionRestriction: 0=None, 1=Horde, 2=Alliance',
`isPublic` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Boolean: 1 = publicly listed and joinable',
`createTime` int unsigned NOT NULL DEFAULT '0' COMMENT 'Unix timestamp of neighborhood creation',
`guildId` int unsigned NOT NULL DEFAULT '0' COMMENT 'M8: owning guild id for guild neighborhoods (0 = not guild-linked)',
PRIMARY KEY (`guid`) USING BTREE,
KEY `idx_owner` (`ownerGuid`) USING BTREE,
KEY `idx_map` (`neighborhoodMapId`) USING BTREE,
KEY `idx_guild` (`guildId`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS=1;