Hello,
few weeks I upgraded to Mattermost 8.1. Now I upgraded to 9.0. And then I wanted to migrate to a new server. After I created a mysqldump I imported the database to the new server.
But then I will get this error:
ERROR 3780 (HY000) at line 1582: Referencing column ‘PolicyId’ and referenced column ‘Id’ in foreign key constraint ‘FK_RetentionPoliciesChannels_RetentionPolic ies’ are incompatible.
Then I deleted this from my mysqldump:
--
-- Table structure for table `RetentionIdsForDeletion`
--
DROP TABLE IF EXISTS `RetentionIdsForDeletion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionIdsForDeletion` (
`Id` varchar(26) NOT NULL,
`TableName` varchar(64) DEFAULT NULL,
`Ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`Ids`)),
PRIMARY KEY (`Id`),
KEY `idx_retentionidsfordeletion_tablename` (`TableName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `RetentionIdsForDeletion`
--
LOCK TABLES `RetentionIdsForDeletion` WRITE;
/*!40000 ALTER TABLE `RetentionIdsForDeletion` DISABLE KEYS */;
/*!40000 ALTER TABLE `RetentionIdsForDeletion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `RetentionPolicies`
--
DROP TABLE IF EXISTS `RetentionPolicies`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPolicies` (
`Id` varchar(26) NOT NULL,
`DisplayName` varchar(64) DEFAULT NULL,
`PostDuration` bigint(20) DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `IDX_RetentionPolicies_DisplayName` (`DisplayName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `RetentionPolicies`
--
LOCK TABLES `RetentionPolicies` WRITE;
/*!40000 ALTER TABLE `RetentionPolicies` DISABLE KEYS */;
/*!40000 ALTER TABLE `RetentionPolicies` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `RetentionPoliciesChannels`
--
DROP TABLE IF EXISTS `RetentionPoliciesChannels`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPoliciesChannels` (
`PolicyId` varchar(26) DEFAULT NULL,
`ChannelId` varchar(26) NOT NULL,
PRIMARY KEY (`ChannelId`),
KEY `IDX_RetentionPoliciesChannels_PolicyId` (`PolicyId`),
CONSTRAINT `FK_RetentionPoliciesChannels_RetentionPolicies` FOREIGN KEY (`PolicyId`) REFERENCES `RetentionPolicies` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `RetentionPoliciesChannels`
--
LOCK TABLES `RetentionPoliciesChannels` WRITE;
/*!40000 ALTER TABLE `RetentionPoliciesChannels` DISABLE KEYS */;
/*!40000 ALTER TABLE `RetentionPoliciesChannels` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `RetentionPoliciesTeams`
--
DROP TABLE IF EXISTS `RetentionPoliciesTeams`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RetentionPoliciesTeams` (
`PolicyId` varchar(26) DEFAULT NULL,
`TeamId` varchar(26) NOT NULL,
PRIMARY KEY (`TeamId`),
KEY `IDX_RetentionPoliciesTeams_PolicyId` (`PolicyId`),
CONSTRAINT `FK_RetentionPoliciesTeams_RetentionPolicies` FOREIGN KEY (`PolicyId`) REFERENCES `RetentionPolicies` (`Id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `RetentionPoliciesTeams`
--
LOCK TABLES `RetentionPoliciesTeams` WRITE;
/*!40000 ALTER TABLE `RetentionPoliciesTeams` DISABLE KEYS */;
/*!40000 ALTER TABLE `RetentionPoliciesTeams` ENABLE KEYS */;
UNLOCK TABLES;
And then the import was working. But I am not sure, if this is fine. Maybe I will have problems in the future, because I removed the mentioned data?
Maybe someone can help and tell me a real fix for this error.
And I think I will use Mattermost Omnibus on the new server. But then I need to convert my mysql db to a postgresql db. And then I need to import this postgresql db to the database which was created automatically from the Omnibus installation. Do you think this is possible?
I really want to create a fresh installation, but we can’t lose all our information, its not possible. Also the link of the team contains still the old company name, so bad. And I can not change it also… I can change it in the database, but maybe this will destroy something? So bad.
Thanks and greetings!