Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News

Specbee: Handling Custom Drupal Migrations Using SqlBase

Posted on November 28, 2023 by Michael G

Author:
Source

There’s so much going on in the world of Drupal migrations. Drupal 9 reached its End Of Life (EOL) on November 1, 2023. Drupal 7 will reach EOL by January 2025 (final extension). Drupal 10 was released back in December 2022 and its current version, 10.1.6 was released on November 1, 2023. More than twelve thousand sites have already migrated to the current version of Drupal 10 (according to the Upgrade Status module download stats).
In this article, we’ll take you through the different Drupal migration methods and especially focus on custom migrations using the SqlBase source plugin. Take a look!

In Technical Terms, What is a Drupal Migration?
Drupal migration is the process of moving content, data, and configuration from another CMS (or an older version of Drupal) to Drupal. A migration consists of several steps: Extract, Transform, and Load (ETL). In the Drupal world, we refer to these as source plugins, process plugins, and destination plugins. The Extract phase is known as the source, Transform is the process, and Load is the destination.
Drupal Migration Methods
When migrating your website from Drupal 7 to Drupal 9 or a later version, there are primarily two migration methods available.
Migration UI 
Drush (Custom migration)
Migration UI 
When you want to migrate your entire web application, including all configurations and content, to a later version, you can use Migration UI. It’s a straightforward option that doesn’t require in-depth knowledge of Drupal APIs. This approach can be used where your site is not too complex in terms of site architecture and considering all the modules used in Drupal 7 are also available in the target version (Drupal 9 or Drupal 10).
Custom Migration
When you are rewriting your website with a more modern and performance-centric approach which leads to significant changes in the architecture of your new website from Drupal 9, Migration UI literally won’t work. In such cases, you’ll need to roll up your sleeves and build custom migration scripts.
Migration Process
Let’s dig deeper into the migration process. It comprises of 3 major processes.
Source plugin (Extract)
Process plugin (Transform)
Destination plugin (Load)
Source Plugin
Source plugins handle the extraction of data from various sources, which can be in different formats, including raw data, databases, and CSV/XML/JSON files. They extract data from these sources and pass it on to the next phase in the migration process.
Process Plugin
The process plugin works on the source data, restructuring it to match the destination process. It transforms the data into an array, where each key corresponds to a destination property. The values assigned to each key determine how the destination values for your new website are generated.
More details can be found here.
Destination plugin
The destination plugin processes the structured data and saves it on your website. The most common destination plugins are node, term, user, and media.
You likely have a grasp of the migration process. Now, let’s delve deeper into source plugins, with a specific focus on the SqlBase source plugin.

Thinking of migrating your Drupal 7 website to Drupal 10? Get your Drupal 7 Site Audit report for Free!
Using SqlBase for the Drupal Migration
What is SqlBase migration?
SqlBase migration is straightforward—it allows you the flexibility to create your custom SQL queries to obtain the desired output. Other than that, it follows the same principles as other Drupal migration methods.
Why should you use SqlBase Migration?
When your site has a straightforward field structure, content types, etc., Drupal core migration can handle it. However, challenges arise with obsolete field types in Drupal 9 or when restructuring an old website with various content types. If you aim for an editor-friendly and performance-oriented site, a simple migration won’t suffice. You’ll need to prepare your source data and take the SqlBase migration route.
In another scenario, if your current site, built on a platform other than Drupal, provides data in the form of a database, SqlBase migration is also the way to go.
Benefits of leveraging SqlBase Migration
Since this is SqlBase, the speed of your migration relies entirely on how well you craft your database queries. The better your query preparation, the faster the migration will run.
It doesn’t rely on many core migration processes; you have the flexibility to shape and process your data as you see fit.
The SqlBase Source Plugin must implement these three methods:
query(): Returns the SQL query that selects the data from the source database.
fields(): Returns available fields on the source.
getIds(): Defines the source fields uniquely identifying a source row
Let’s get into the details of what these functions should contain:
query() function
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select(‘job_details’, ‘c’)
->fields(‘c’, array(
‘id’,
‘title’,
‘description’,o
‘position’,
‘company’,
‘criteria’,
));
return $query;
}fields() function
/**
* {@inheritdoc}
*/
public function fields() {
$fields = array(
‘id’= $this->t(‘Autoincrement ID’),
‘title’ = $this->t(‘Job Title’),
‘description’ = $this->t(‘Job Description’),
‘position’ = $this->t(‘Job Position’),
‘company’.= $this->t(‘Company’),
‘criteria’ = $this-»t(‘Job Criteria’),
);
return $fields;
}getIds() function
/**
* {@inheritdoc}
*/
public function getIds() {
return [
‘id’ => [
‘type’ => ‘integer’,
‘alias’=>’j’
];
}Additionally, you can tweak your SQL result by using the prepareRow() function and even add new source properties to your migration.
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
$company = $row->getSourceProperty(‘company’);

$row->setSourceProperty(‘job_type’, ‘on-site’);
if ($company == ‘specbee’) {
$row->setSourceProperty(‘job_type’, ‘remote’);
}

return parent::prepareRow($row);
}These source properties will be sent to your migration yml files and you can also use your own processor if you want any additional processing on your source data.
Referenceshttps://www.drupal.org/project/usage/3398311
Final Thoughts
With Drupal 9’s EOL, the impending farewell to Drupal 7, and the rise of Drupal 10, the need for seamless transitions has never been more pressing. As Drupal evolves, our Drupal Development Company recognizes SqlBase as an essential tool for a seamless and efficient migration process. Offering the flexibility to shape personalized SQL queries, it plays a vital role in crafting tailored data transitions. If you’re looking for a reliable Drupal migration partner, we’re just a form away! 

Read more

Related Posts:

  • Specbee: Migrate to Drupal 9 (or 10) Without Losing Your Hard-Earned SEO Ranking
    Specbee: Migrate to Drupal 9 (or 10) Without Losing…
  • Specbee: Getting Started with Layout Builder in Drupal 9 - A Complete Guide
    Specbee: Getting Started with Layout Builder in…
  • Specbee: Mastering Drupal 9 Layout Builder: A Comprehensive Guide to Effortlessly Customize Your Website's Design
    Specbee: Mastering Drupal 9 Layout Builder: A…
  • Specbee: The Ultimate Guide to Jumpstart your Drupal Contribution Journey
    Specbee: The Ultimate Guide to Jumpstart your Drupal…
  • Specbee: Understanding Update and Post Update Hooks for Successful Site Updates
    Specbee: Understanding Update and Post Update Hooks…
  • Specbee: How to create and apply a patch with Git Diff and Git Apply commands for your Drupal website
    Specbee: How to create and apply a patch with Git…

Recent Posts

  • [TUT] LoRa & LoRaWAN – MikroTik wAP LR8 kit mit The Things Network verbinden [4K | DE]
  • Mercado aguarda Powell e olha Trump, dados e Haddad | MINUTO TOURO DE OURO – 11/02/25
  • Dan Levy Gets Candid About Learning How To Act Differently After Schitt’s Creek: ‘It’s Physically…
  • Building a Rock Shelter & Overnight Stay in Heavy Snow 🏕️⛰️
  • Les milliardaires Elon Musk et Xavier Niel s’insultent copieusement

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT