This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-01
Channels
- # announcements (11)
- # babashka (71)
- # beginners (34)
- # calva (25)
- # chlorine-clover (38)
- # cider (13)
- # clj-kondo (1)
- # cljsrn (2)
- # clojure (40)
- # clojure-australia (4)
- # clojure-europe (16)
- # clojure-france (3)
- # clojure-nl (4)
- # clojure-uk (16)
- # clojurescript (27)
- # conjure (2)
- # core-async (41)
- # core-logic (3)
- # cursive (1)
- # data-science (1)
- # datomic (16)
- # depstar (19)
- # emacs (7)
- # fulcro (33)
- # graalvm (4)
- # honeysql (20)
- # hugsql (4)
- # jobs (1)
- # juxt (4)
- # off-topic (48)
- # pathom (41)
- # reagent (9)
- # reitit (19)
- # remote-jobs (1)
- # shadow-cljs (20)
- # startup-in-a-month (2)
- # tools-deps (29)
- # vim (3)
- # xtdb (30)
Hello! I have :region/city
attribute with cardinality many and type string of :region
entity in schema. Is there a way to change it on ref type with saving its id? I tried to change a type directly, add an aliase id->ident
, both with and without clearing existing values - datomic rises an error everytime.
I think you’re asking if you can change :region/city to be ref instead of string typed? You cannot change the type of attributes. You can make a new attribute of the same name, but the old assertions will remain
I suggest for your sanity making a new attribute with a different name and working out your migration of old data to new. Only then consider changing names again; but with a large codebase it’s often just not worth it.
I hide the details for make long story short - I created new attribute with new name & type and migrated all the data and cleared the values of old atttributes. But finally I need that old attribute name with new values.
rename the string attribute to something else; then rename the ref attribute to :region/city
and make sure your code is ready for that, because ref and string are not compatible types
What means "rename attribute"?
[[{:db/id :region/cities
:db/ident :region/cities-old}
{:db/id :region/cities-ref
:db/ident :region/cities}]]
@U09R86PA4 thanks alot! Everything works and fine now, except little moment, that I have that old region attribute in schema without values )