> ## Documentation Index
> Fetch the complete documentation index at: https://flex-fields.bjanczak.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Examples target Filament 5. Verify optional dependencies before configuring integrations.
> Upload transfer completion, permanent storage and record acceptance are separate milestones. Native and Spatie image conversions retain the original.

# Migrate related fields together

> Validate a related batch against real state paths while keeping persistence application-owned.

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
$results = app(FamilySchemaMigration::class)->prepareMany(
    snapshots: $storedSnapshots,
    context: $context,
    authorizeMigration: fn ($field, $context): bool =>
        $fieldPolicy->canMigrate($actor, $record, $field->family),
);
```

The batch accepts at most 256 snapshots and an aggregate 8 MiB input/result value
budget. It rejects duplicate state paths. All metadata, migration support,
authorization and rule declarations are checked before value converters run.
Target rules validate the complete converted payload on its actual field paths,
so dependent rules can compare fields in the same batch. The method returns all
results only after successful validation; it never returns a partial successful
batch. The application still owns the atomic database transaction.

For a rollback, reinstall the compatible older package and explicitly migrate
the newer snapshot using a declared reverse conversion. Alternatively, validate
and restore the retained `before` snapshot under the older installed contract.
Unrecognized newer versions are never relabeled as older versions automatically.
Keep a record revision check when restoring history to avoid overwriting later edits.

## Continue reading

[Extension guides](https://flex-fields.bjanczak.com/docs/extensions.md) · [Definition and registration reference](https://flex-fields.bjanczak.com/docs/extensions/definition-reference.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.