From 2a31ad2e099382d4653897b7157c9db7f0a0359c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Wed, 15 May 2024 17:41:49 +0200 Subject: [PATCH] feat: add simple example --- source/migration/index.ts | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/source/migration/index.ts b/source/migration/index.ts index a86cb47..1392a39 100644 --- a/source/migration/index.ts +++ b/source/migration/index.ts @@ -6,8 +6,41 @@ ### Usage -TODO: add simple example +For instance, we have a simple set of rules: +```yaml +age: + question: "Quel est votre âge ?" +```` + +and the following situation: +```json +{ + age: 25 +} +``` + +If I change my model because I want to fix the accent to: + +```yaml +âge: + question: "Quel est votre âge ?" +``` + +I don't want to lose the previous answer, so I can use `migrateSituation` with the following migration instructions: + +```yaml +keysToMigrate: + age: âge +``` + +Then, calling `migrateSituation` with the situation and the migration instructions will return: + +```json +{ + âge: 25 +} +``` */ export * from './migrateSituation'