Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions products/tools/cli/project-commands/mysql-dump.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,25 @@ dump:
where:
<table-name>: 'id > 5'
```

## Limiting the number of rows

Use the `--limit` flag to cap the number of rows exported for a table, for example to keep only the newest orders:

```bash
shopware-cli project dump --limit order=100
```

Tables referencing the limited table via foreign keys (including transitively) are filtered automatically, so they only contain rows belonging to the kept rows. A second limit on a table that is already filtered this way is rejected. When the limited table references itself (for example `product.parent_id`), the ancestors of the kept rows are exported too, so the dump stays importable. This requires the `CREATE` and `DROP` privileges, since the kept rows are frozen into staging tables.

The same behavior can be configured persistently in `.shopware-project.yml`:

```yaml
# .shopware-project.yml
dump:
limit:
<table-name>:
rows: 100
# Defaults to "created_at DESC" when the table has a created_at column
order_by: 'created_at DESC'
```
Loading