Skip to main content

Drupal: how to import the configuration on a different site

After cloning a site, next you will want to import the config file.  Which you can do so by running the command:

drush cim -y

Hopefully it worked for you.  As it didn't work out so well for me as the response was:

Drush a few common commands to import and reset

Working through and importing JSON data into a content type.

 

Drush migration commands

Check the status of the migration data

lando drush migrate-status

Reset the migration status 

lando drush migrate-reset-status  migratable_riverdata_json

Import JSON data

CLI using drush to drop tables in your db and reload

This is a relatively quick process, beginning with dropping the database tables

lando drush sql-drop -y

Import a MySQL database

lando db-import {filename}

such as 

lando db-import riverdev.2022-10-03-1664769553.sql.gz

Rebuild cache

lando drush cr

Finally, export your config

Running Drupal 9 locally with lando using remote files and db

Import a database

lando db-import doj.sql

Enter the MySQL database

lando mysql -h database

This action will change the prompt as you are now in mysql.  The prompt will start with

mysql>

Now change to the database that you want to use

use doj;

If you want to know what databases exist, then run

Drush - rebuild node access permissions

How do you rebuild node access permissions using CLI?

To rebuild permissions from the command-line using Drush:

drush php-eval 'node_access_rebuild();'

Or using Drupal Console:

drupal node:access:rebuild

 

Importing and Exporting a MySQL database with Drush

These steps are for Drupal 8 and 9.

 

Export your database

Order here is important.  First you want to clear all the Drupal caches.  Then export / dump the db the sql database to a file in your home directory.

drush cr
drush sql-dump > path/to/your/file/ourpout/sql-dump-file-name.sql

or

Set-up Docker for Drupal

Is Docker installed?

Check if your installation is ok and spin up Docker as well:

docker -D info

 

Using Docker

Now it's time to download and install docker images. Using the official images of MariaDB and Drupal. If you don’t specify the absolute URL to the image it will be searched and downloaded from Docker Hub. Tag 'latest' will be used by default.

Setting up synonyms on your Drupal site with a few errors you might experience along the way

Having Drupal Solr Search APi running, I thought adding synonyms to the mix would be a smooth process.

 

Install synonym module

I cam across a synonym module created by Jens Beltofte - Search API Synonym.  Working on a Drupal 9.3.x installation, this module needs to be accessed via Git Search API Synonym,

Install / uninstall modules and themes using composer


Using Composer to Manage Projects and if required their dependencies

In this section, we're going to dive into how to use Composer to manage project dependencies. Specifically, we'll cover the following:

Subscribe to Drush