Email us at info@henrytech.org to discuss your Drupal Migration today!
Things you will need:
1) MSSQL (or Sitecore) database file
3) Docker
Steps:
1) Extract MSSQL (or Sitecore) database file (most likely .zip)
2) Run this command in terminal to setup SQL Server: `docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=MyPass@word
3) Download and install datagrip: https://www.jetbrains.com/
4) Connect to your local docker instance through datagrip using the username, password and port in the above command
5) In the terminal, copy the database file you want to use to a location INSIDE the docker container like so: `docker cp ./DBSitecore_Web.bak sql:/app` (if this is a Sitecore database, choose the "_Web" file)
6) Right-click the local instance you've connected and click "Restore" and choose the file you just copied into the app/ folder
7) Your database should now appear and now you can export whatever tables you need. In our case, we need the Sitecore "VersionedFields" and the "Items" tables. Right click the table and Choose "Export data to file" and choose the "SQL insert multirow" option
8) After you've exported it, open the sql files and replace the headers AND footers to replace everything just past the "VALUES" mark. The Sitecore headers are included here for convenience. We are simply replacing the headers that went with the export. These headers are specifically for Sitecore. If you have a different type of MSSQL database, simply replace your headers with information specific to the tables you are exporting. If you don't know what to put for your headers, you can export a mysql table from your mysql Drupal database and examine it.
########################
Versioned Fields Table
########################
```
# ******************************
#
# Host: 127.0.0.1 (MySQL 5.7.29)
# Database: drupal10
# Generation Time: 2023-04-05 14:37:00 +0000
# ******************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@
/*!40101 SET @OLD_COLLATION_CONNECTION=@@
SET NAMES utf8mb4;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@
/*!40101 SET @OLD_SQL_MODE='NO_AUTO_VALUE_
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table versioned_fields
# ------------------------------
DROP TABLE IF EXISTS `versioned_fields`;
CREATE TABLE `versioned_fields` (
`id` varchar(128) CHARACTER SET ascii NOT NULL,
`item_id` varchar(128) CHARACTER SET ascii NOT NULL,
`language` varchar(50) CHARACTER SET ascii NOT NULL,
`version` int(10) unsigned NOT NULL,
`field_id` varchar(128) CHARACTER SET ascii NOT NULL,
`value` longblob,
`created` varchar(128) NOT NULL,
`changed` varchar(128) NOT NULL,
`dac_index` int(10) unsigned NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `item_id` (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='The base table for versioned_fields entities.';
LOCK TABLES `versioned_fields` WRITE;
/*!40000 ALTER TABLE `versioned_fields` DISABLE KEYS */;
INSERT INTO `versioned_fields` (`id`, `item_id`, `language`, `version`, `field_id`, `value`, `created`, `changed`, `dac_index`)
VALUES
```
AT THE BOTTOM: (UNDER ALL VALUES)
```
/*!40000 ALTER TABLE `versioned_fields` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_
/*!40101 SET COLLATION_CONNECTION=@OLD_
```
########################
Items Table
########################
```
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@
/*!40101 SET @OLD_COLLATION_CONNECTION=@@
SET NAMES utf8mb4;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@
/*!40101 SET @OLD_SQL_MODE='NO_AUTO_VALUE_
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table items
# ------------------------------
DROP TABLE IF EXISTS `items`;
CREATE TABLE `items` (
`id` varchar(128) CHARACTER SET ascii NOT NULL,
`name` varchar(256) CHARACTER SET ascii NOT NULL,
`template_id` varchar(128) CHARACTER SET ascii NOT NULL,
`master_id` varchar(128) CHARACTER SET ascii NOT NULL,
`parent_id` varchar(128) CHARACTER SET ascii NOT NULL,
`created` varchar(128) NOT NULL,
`changed` varchar(128) NOT NULL,
`dac_index` int(10) unsigned NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `item_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='The base table for items.';
LOCK TABLES `items` WRITE;
/*!40000 ALTER TABLE `items` DISABLE KEYS */;
INSERT INTO `items` (`id`, `name`, `template_id`, `master_id`, `parent_id`, `created`, `changed`, `dac_index`)
VALUES
```
AT THE BOTTOM: (UNDER ALL VALUES)
```/*!40000 ALTER TABLE `items` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_
/*!40101 SET COLLATION_CONNECTION=@OLD_
9) Now you can re-import these tables, one at a time, into a blank MYSQL migration database instance inside your lando or ddev container. One step closer to migration!
Comments