How can I modify :db.valueType in Datomic?

70 views Asked by At

I know :db.valueType should not be modified and I would never do this in production, but I'm developing my database locally and made a mistake in the type of an attribute. I wish to change the type from :db.type/bigdec to :db.type/string. Since it is my dev env, I can delete the entire database and start from scratch, but it would be nice and convenient if I could just change the type of this one attribute in the schema.

Is it possible?

The schema definition for the particular attribute looks like:

{:db/ident       :data/value
 :db/valueType   :db.type/bigdec
 :db/cardinality :db.cardinality/one
 :db/doc         "The measured value. A string is used to preserve the user formatting of the number."}

And I wish it to look like (note the difference in type):

{:db/ident       :data/value
 :db/valueType   :db.type/string
 :db/cardinality :db.cardinality/one
 :db/doc         "The measured value. A string is used to preserve the user formatting of the number."}

Note: I can delete all values associated with :data/value (not retract, delete). Of course, I'd need to know how to do that, too. Also, this just happened and none of the code is checked into source control... I really don't want to retain this mistake. I want to correct it and pretend like it never happened... At this point, it is really possible to pretend like it never happened since nothing was checked into source control, nothing was deployed, everything is local and changes are just in one source file and my local Datomic database. So it's a very particular case that I would not generalize arbitrarily. I understand the hesitancy of hiding mistakes like this and would not normally do that.

0

There are 0 answers