Strata · Migrations
Document migrations
A document migration is a migration in a grammar sequence: the sequence owns document kinds where other sequences own tables, and its steps are transforms. Each step names the kind it applies to in at; its transform is passed { document, path } and returns the rewritten document. With Prism as the evaluator a rename is one $renameKeys expression, here label to text.
{
id: 'theatre.buttons',
documents: { button: {} },
migrations: [
{
description: 'label is now text',
steps: [
{
kind: 'document',
at: 'theatre.buttons/button',
transform: {
$renameKeys: { from: { $ref: '$.document' }, map: { label: 'text' } },
},
},
],
},
],
}{ label: 'Book seats', tone: 'primary' }{ text: 'Book seats', tone: 'primary' }Runs in this page on the installed package. The input and the expected output are defined by the example.