05.02.2026 | Michael Ebert

Make a database dump including data from an ignored table

drush_override_ignored_table_list.sql
drush sql:dump --structure-tables-list=cache,cachetags,'cache_*',history,'search_*',sessions,webprofiler

Issue:

You need a dump including the values of a datebase table that is ignored by your drush configuration.

Prerequisites:

You use drush in your setup and have a drush config file (e.g.: https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml)  like this:

drush.yml
command:
  sql:
    dump:
      options:
        structure-tables-list:
          - cache
          - cachetags
          - 'cache_*'
          - history
          - 'search_*'
          - 'sessions'
          - 'watchdog'
          - 'webprofiler'

Solution:

This example overrides the settings for the ignored tables in your drush command to also get the data of the watchdog table.

Weitere DevBits

13.11.2025 | Michael Ebert

Warm your Drupal caches after a cache clear

my_module.services.yml
tags:
  - { name: cache_prewarmable }

MyPlugin.php
/**
  * Implements \Drupal\Core\PreWarm\PreWarmableInterface.
  */
public function preWarm(): void {
  $this->getDefinitions();
}

services
drush
caching
API
13.11.2025 | Peter Majmesku

Drush 12+: Simplified Drush commands with PHP 8 attributes

HelloWorldCommands.php
<?php

declare(strict_types=1);

namespace Drupal\nice_module\Drush\Commands;

use Drupal\Component\DependencyInjection\ContainerInterface;
use Drupal\nice_module\HelloWorldService;
use Drush\Attributes as CLI;
use Drush\Commands\DrushCommands;

/**
 * A Drush command class for saying "hello" to the world.
 */
final class HelloWorldCommands extends DrushCommands {

  public function __construct(
    private readonly HelloWorldService $helloWorldService,
  ) {
    parent::__construct();
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container): self {
    return new static($container->get('nice_module.hello_world_service'));
  }

  #[CLI\Command(name: 'nice_module:say-hello', aliases: ['smci'])]
  #[CLI\Argument(name: 'userName', description: 'The name of the user.')]
  public function sayHello(?string $userName = NULL): void {
    $this->helloWorldService->sayHello($userName, $this->output());
    $this->logger()->success('I said "hello" to the user.');
  }

}
drush
php