Skip to content

Stripped Database Dumps

Savvas Radevic edited this page May 2, 2020 · 24 revisions

Stripped Database Dump

Dumps your database and excludes some tables. This is useful i.e. for development.

Separate each table to strip by a space. You can use wildcards like * and ? in the table names to strip multiple tables. In addition you can specify pre-defined table groups that start with an @.

Example:

$ n98-magerun2.phar db:dump --strip="dataflow_batch_export unimportant_module_* @log @stripped"

Available Table Groups:

  • @admin Admin tables
  • @log Log tables
  • @dataflowtemp Temporary tables of the dataflow import/export tool
  • @importexporttemp Temporary tables of the Import/Export module
  • @sessions Database session tables
  • @stripped Standard definition for a stripped dump (logs, sessions, import/export and dataflow) (short for --strip="@log @dataflowtemp @importexporttemp @sessions")
  • @sales Sales data (orders, invoices, creditmemos etc)
  • @customers Customer data - Should not be used without @sales
  • @emails Email queue tables
  • @newsletter Newsletter subscriber data
  • @trade Current trade data (customers and orders). You usually do not want those in developer systems. (short for --strip="@customers @sales")
  • @development Removes admin users, logs, search, newsletter, emails and trade data so developers do not have to work with real customer data (short for --strip="@admin @trade @stripped @search @newsletter @emails")
  • @ee_changelog Changelog tables of new indexer since EE 1.13
  • @search Search related tables
  • @idx Tables with _idx suffix and index event tables

See it in action:

http://youtu.be/ttjZHY6vThs

Add your own groups

You can extend or modify the groups by creating your own config ~/.n98-magerun.yaml or project-specific config in app/etc/n98-magerun.yaml file.

Example:

commands:
  N98\Magento\Command\Database\DumpCommand:
    table-groups:
      - id: "n98"
        description: "Tables starting with n98"
        tables: "n98*"
      - id: "foo"
        description: "Mix groups and single table names"
        tables: "foo bar @log"
      - id: "development_custom"
        description: "Removes logs and trade data so developers do not have to work with real customer data"
        tables: "@development @n98"