Skip to content
Christian Münch edited this page Jun 27, 2023 · 5 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.
  • @oauth OAuth tables.
  • @log Log tables.
  • @sessions Database session tables.
  • @stripped Standard definition for a stripped dump (logs, sessions, dotmailer).
  • @sales Sales data (orders, invoices, creditmemos etc).
  • @quotes Cart (quote) data.
  • @customers Customer data - Should not be used without @sales.
  • @trade Current trade data (customers and orders). You usally do not want those in developer systems.
  • @development Removes logs and trade data so developers do not have to
  • @search Search related tables.
  • @idx Tables with _idx suffix.
  • @dotmailer Dotmailer tables.
  • @2fa Two Factor Auth tables.
  • @newrelic_reporting New Relic reporting tables.
  • @aggregated Aggregated tables.
  • @replica Replica tables.
  • @klarna Klarna tables.
  • @temp Temporary indexer tables.
  • @mailchimp Mailchimp tables.

Run the command with --help to see a up-to-date list of available groups.

Add your own groups

You can extend or modify the groups by creating your own config ~/.n98-magerun2.yaml or project-specific config in app/etc/n98-magerun2.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"

Verify with db:dump --help if your new groups is registered.