From 17665c929c3a9fb7fe75dd680648129bc1c1f874 Mon Sep 17 00:00:00 2001
From: Shauren <shauren.trinity@gmail.com>
Date: Sun, 22 Jul 2018 13:22:35 +0200
Subject: Core/Instances: Instance lock rewrite (WIP)

---
 sql/base/characters_database.sql | 51 ++++++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 12 deletions(-)

(limited to 'sql/base/characters_database.sql')

diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql
index 743da3345dc..9f9f7482298 100644
--- a/sql/base/characters_database.sql
+++ b/sql/base/characters_database.sql
@@ -1119,6 +1119,38 @@ LOCK TABLES `character_instance` WRITE;
 /*!40000 ALTER TABLE `character_instance` ENABLE KEYS */;
 UNLOCK TABLES;
 
+--
+-- Table structure for table `character_instance_lock`
+--
+
+DROP TABLE IF EXISTS `character_instance_lock`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!50503 SET character_set_client = utf8mb4 */;
+CREATE TABLE `character_instance_lock` (
+  `guid` bigint unsigned NOT NULL,
+  `mapId` int unsigned NOT NULL,
+  `lockId` int unsigned NOT NULL,
+  `instanceId` int unsigned DEFAULT NULL,
+  `difficulty` tinyint unsigned DEFAULT NULL,
+  `data` text COLLATE utf8mb4_unicode_ci,
+  `completedEncountersMask` int unsigned DEFAULT NULL,
+  `entranceWorldSafeLocId` int unsigned DEFAULT NULL,
+  `expiryTime` bigint unsigned DEFAULT NULL,
+  `extended` tinyint unsigned DEFAULT NULL,
+  PRIMARY KEY (`guid`,`mapId`,`lockId`),
+  UNIQUE KEY `uk_character_instanceId` (`guid`,`instanceId`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `character_instance_lock`
+--
+
+LOCK TABLES `character_instance_lock` WRITE;
+/*!40000 ALTER TABLE `character_instance_lock` DISABLE KEYS */;
+/*!40000 ALTER TABLE `character_instance_lock` ENABLE KEYS */;
+UNLOCK TABLES;
+
 --
 -- Table structure for table `character_inventory`
 --
@@ -2588,17 +2620,11 @@ DROP TABLE IF EXISTS `instance`;
 /*!40101 SET @saved_cs_client     = @@character_set_client */;
 /*!50503 SET character_set_client = utf8mb4 */;
 CREATE TABLE `instance` (
-  `id` int unsigned NOT NULL DEFAULT '0',
-  `map` smallint unsigned NOT NULL DEFAULT '0',
-  `resettime` bigint NOT NULL DEFAULT '0',
-  `difficulty` tinyint unsigned NOT NULL DEFAULT '0',
-  `completedEncounters` int unsigned NOT NULL DEFAULT '0',
-  `data` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
-  `entranceId` int unsigned NOT NULL DEFAULT '0',
-  PRIMARY KEY (`id`),
-  KEY `map` (`map`),
-  KEY `resettime` (`resettime`),
-  KEY `difficulty` (`difficulty`)
+  `instanceId` int unsigned NOT NULL,
+  `data` text COLLATE utf8mb4_unicode_ci,
+  `completedEncountersMask` int unsigned DEFAULT NULL,
+  `entranceWorldSafeLocId` int unsigned DEFAULT NULL,
+  PRIMARY KEY (`instanceId`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
@@ -3677,7 +3703,8 @@ INSERT INTO `updates` VALUES
 ('2022_07_25_00_characters.sql','3159BB2F3C346A7881920AB2B1F8108247CF13EE','ARCHIVED','2022-07-25 18:44:10',0),
 ('2022_08_19_00_characters.sql','1C076A24F2B48F32E8EF835C01F8907CA9E86491','ARCHIVED','2022-08-19 23:43:01',0),
 ('2022_08_21_00_characters.sql','1D75688392FBDA18CD8494F32CF682DCB49642EC','ARCHIVED','2022-08-21 00:02:03',0),
-('2022_09_18_00_characters.sql','A7DF0C1F0E074F3E63A6CDD0AF873A1F3DC33B29','RELEASED','2022-09-18 21:48:42',0);
+('2022_09_18_00_characters.sql','A7DF0C1F0E074F3E63A6CDD0AF873A1F3DC33B29','RELEASED','2022-09-18 21:48:42',0),
+('2022_10_03_00_characters.sql','7B062787230D9158A622EB4AFE7FA6D18AB47BB3','RELEASED','2022-10-03 22:32:58',0);
 /*!40000 ALTER TABLE `updates` ENABLE KEYS */;
 UNLOCK TABLES;
 
-- 
cgit v1.2.3

