Skip to content

Commit c4e25f0

Browse files
committed
Insert array in migration, rather than create a new (nested) array
Before migrations: "widgets": [ { "n": "pages", "s": { "limit_pages": 10, "limit_refs": 10 } }, [..] { "n": "locations", "s": { "key": "", "limit": 6 } } ] After migrations it was: "widgets": [ [ { "n": "pages", "s": { "limit_pages": 10, "limit_refs": 10 } }, [..] { "n": "locations", "s": { "key": "", "limit": 6 } } ], { "n": "languages" } ] So that's an extra level, since json_array() creates a new array, rather than merging two arrays. #569 (comment)
1 parent d869938 commit c4e25f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
update sites set
22
settings = json_replace(settings, '$.collect', json_extract(settings, '$.collect') | 64),
3-
user_defaults = json_replace(user_defaults, '$.widgets', json_array(json_extract(user_defaults, '$.widgets'), json('{"n":"languages"}')));
3+
user_defaults = json_replace(user_defaults, '$.widgets', json_insert(json_extract(user_defaults, '$.widgets'), '$[#]', json('{"n":"languages"}')));
44
update users set
5-
settings = json_replace(settings, '$.widgets', json_array(json_extract(settings, '$.widgets'), json('{"n":"languages"}')));
5+
settings = json_replace(settings, '$.widgets', json_insert(json_extract(settings, '$.widgets'), '$[#]', json('{"n":"languages"}')));

0 commit comments

Comments
 (0)