-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Description
I've seen this - #41
Seems that using the dumper dumps to string that can't be later read properly with SQLite, it stores it like this in a JSON field in SQLite:
"{\"property_type\":\"foo\",\"__type__\":\"something\"}"
instead of like this:
{"property_type": "foo", "__type__": "something"}
Means functions like json_extract etc won't work natively in SQLite.
I believe it's because when dumping it's done this way:
dumper.(:map, map)
So with SQLite, this dumps as a string:
{:ok,
"{\"foo\":\"x\",\"bar\":\"2021-12-03T07:22:16.086910Z\",\"baz\":\"xxx\",\"__type__\":\"something\"}"}
But with Postgres it dumps as a map:
{:ok,
%{
:something => "hello",
"__type__" => :"Whatever"
}}
Not sure if this is an ecto_sqlite3 problem or a polymorphic_embed issue.
It looks like creating normal maps works properly as JSON.
Metadata
Metadata
Assignees
Labels
No labels