Loại bỏ 1 số tables bằng Drush sql-dump and sql-sync

Loại bỏ 1 số tables bằng Drush sql-dump and sql-sync

At KnackForge we use Drush more often as a part of Drupal development projects. As Drupal developers, we frequently feel the need for getting the most recent database dump from live site. When I did this recently, it was relatively a big site, thought it would be nice to skip a few tables that are not essential. At least to avoid unnecessary time spent on I/O operations. This is one of the few things that I have least tried with Drush.

Quick Google Search led me to Drush project issue in drupal.org, mostly outdated posts. Had to connect the dots found here and there to get eventually what I needed, hence writing this blog post.

To skip specific tables when using drush sql-dump and sql-sync, in drushrc.php need to have the below code in place,

<?php
$options['structure-tables'] = array(
  'common' => array(
    'cache',
    'cache_block',
    'cache_filter',
    'cache_form',
    'cache_menu',
    'cache_page',
    'cache_update',
    'history',
    'watchdog',
    'simplenews_subscription',
    'simplenews_subscriber',
    'customtable_1',
    'customtable_2'
  ),
);
$options['structure-tables-key'] = 'common';
?>

Once done, for all sql-dump and sql-sync commands you would issue, the above tables will be skipped.

Note: 

  1. Beware if any of the above table is not found in your Drupal database the command will fail to complete successfully
  2. To have skip list per site, you can place drushrc.php in sites/default/ folder.

Hope this will help.

Bạn thấy bài viết này như thế nào?: 
Average: 10 (1 vote)
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Registry Repair Wizard

Hướng dẫn cài đặt phần mềm registry repair wizard sửa lỗi registry cho windows

Registry Repair Wizard sẽ kiểm tra Windows Registry để tìm ra những sai sót trong hệ thống registry.

Domain Authority là gì?

Domain Authority là gì?

Domain Authority (DA) là một thước đo của SEOmoz dùng để dự đoán “sức mạnh” của website này so với website khác trên bảng xếp hạng của các SE.

Phần 2: Migrating users từ Drupal 7 sang Drupal 8 site

Phần 2: Migrating users từ Drupal 7 sang Drupal 8 site

The Drupal 8 Migration system is very flexible and can be used to migrate many types of data

Công ty diệt chuột T&C

 

Diet con trung