Bulk update records
bulk_update_recordsChange multiple RPG Maker MV database records at once by IDs or conditions, with a diff preview before writing.
Instructions
Change one or more fields on many database records at once, with a diff. Example - all weapons +10% attack: {type: 'weapons', changes: [{field: 'params.atk', op: 'percent', value: 10}]}. Select records with ids and/or where conditions (all must match); with neither, every record is selected. Fields are paths such as 'price', 'params.atk' (mhp/mmp/atk/def/mat/mdf/agi/luk), 'params[2]', 'damage.formula', 'traits[0].value'. Ops: set (any value), add, multiply, percent (+value%) - numeric ops round to whole numbers for integer fields (round: auto), with optional min/max clamps. DRY RUN BY DEFAULT: nothing is written until you pass dryRun=false, so show the diff to the user first. If any record fails, nothing is written.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | No | Only these record ids | |
| type | Yes | ||
| where | No | Conditions, e.g. [{field: 'wtypeId', op: 'eq', value: 1}, {field: 'name', op: 'contains', value: 'sword'}] | |
| dryRun | No | true = only preview the diff (default), false = write the changes | |
| changes | Yes | ||
| maxPreview | No | Maximum records shown in the diff |