Fork me on GitHub
#fulcro
<
2021-10-13
>
xceno10:10:53

I've got a problem with the automatic migration feature of RAD. I've introduced the following attributes, trying to https://docs.datomic.com/cloud/best.html#annotate-schema:

(datomic-common/automatic-schema model/all-attributes :production)
=>
...
{:db/ident :sil.room-def/gross-floor-area,
  :db/cardinality :db.cardinality/one,
  :db/valueType :db.type/long,
  :db/doc "Deprecated. This is an integer field, but we need decimals. Use sil.room-def/gross-floor-area2 instead.",
  :sil.schema/deprecated? true,
  :sil.schema/replaced-by [:sil.room-def/gross-floor-area2]}

#:db{:ident :sil.schema/deprecated?,
      :cardinality :db.cardinality/one,
      :valueType :db.type/boolean,
      :doc "Boolean flag indicating the field has been deprecated"}

#:db{:ident :sil.schema/replaced-by,
     :cardinality :db.cardinality/many,
     :valueType :db.type/ref,
     :doc "Used to document when a deprecated field is replaced by others."}
If I add the :sil.schema/deprecated? and replaced-by attributes manually, before starting the automatic migration everything works fine. But letting it run automatically on an empty DB throws this:
Execution error (ExceptionInfo) at datomic.core.error/raise (error.clj:55).
:db.error/not-an-entity Unable to resolve entity: :sil.schema/deprecated?
So when transacting the automatic-schema does the order of the attributes matter, or do we always need to transact schema extending attributes beforehand?

tony.kay16:10:53

RAD schema support understands that tuples need to run in their own txn to make sure the others exist first. There is no (existing) mechanism to do what you’re doing into the automatic system…you’d need to add that as a migration system, since it is meant to migrate things that already existed on startup.

xceno09:10:19

understood, thanks!

mlimotte16:10:52

[JOB] Hi all, At Skipp Technologies, we’re looking for a contractor to add a few new sections to our existing Fulcro app, asap.. Let me know if you’re interested in hearing more. DM me here, or email <mailto:[email protected]|[email protected]> or see more on our AngelList post: https://angel.co/l/2vWm8r

💯 2