Fork me on GitHub
#datomic
<
2018-07-26
>
octahedrion10:07:16

I really wish I'd added a :db/unique :db.unique/identity to an attribute but it's too late as there are multiple values in the current set of database assertions -- I tried retracting all but one of those assertions but to no avail, is there anything I can do ?

chrisblom10:07:40

does you attribute use :db.cardinality/one?

octahedrion10:07:05

yes, but the 2nd condition in the green box is not met

chrisblom10:07:40

is there any reason you cannot remove the duplicate values?

octahedrion10:07:56

as I said - I tried retracting them

chrisblom10:07:33

and the values are unique afterwards?

steveb8n10:07:58

Has anyone setup CI to push/deploy Ions yet? If so, anything to watch out for? How do you do auth for the CLI in the CI env?

👍 4
octahedrion11:07:32

ok - I think I've found a way: I renamed the offending attribute :old-attribute-name and asserted the attribute again with the unique constraint, which works, thereafter one has only has the small inconvenience of having to specify the attribute in one's queries (to prevent assertions for the old one appearing)

octahedrion11:07:01

and naturally I have to assert the latest values of the old attribute on the new one

octahedrion11:07:06

but that's ok

curtosis17:07:54

really dumb question, but I’m drawing a blank today: how do you programmatically build a query that takes a UUID string as parameter?

octahedrion17:07:27

(d/q '{:find [?n] :in [$ ?uuid] :where [[?n :uuid ?uuid]]} (d/db conn) uuid)

octahedrion18:07:48

- programmatically manipulate the map as you wish

curtosis18:07:02

looks like what I’m trying, but that doesn’t work. I can run it in the console with [?e :org/id #uuid "string"] , but without the reader tag in my query it won’t match.

octahedrion18:07:01

try (UUID/fromString uuid-string)

curtosis18:07:13

I think that’s what I’m looking for, but somehow that’s not working.

curtosis18:07:55

(d/q '[:find ?org .
                   :in $ ?orgId
                   :where [?org :organization/id (UUID/fromString ?orgId)]]
                 db orgId )

octahedrion18:07:30

do the UUID/fromString outside the query

octahedrion18:07:13

outside the :where clause I mean

octahedrion18:07:35

db (UUID/fromString orgId)

octahedrion18:07:45

or pass in a UUID not a string

curtosis18:07:47

right. That works! Thanks!

octahedrion18:07:00

better to pass in UUIDs

curtosis18:07:28

unfortunately coming in from graphql /js so it’ll be a string, but easily managed.

octahedrion18:07:58

convert elsewhere before using in query

curtosis18:07:19

hmmm… wonder why stillsuit isn’t picking it up right then

Peter Wilkins18:07:55

should probably move to graphql channel?

Peter Wilkins18:07:57

I’m having trouble getting a postgres backend setup. the jdbc uri looks ok but when I try to backup from s3 computer says no

bin/datomic -Xmx1g -Xms1g restore-db  'jdbc:'
java.lang.IllegalArgumentException: :db.error/invalid-db-uri Invalid database URI jdbc:

curtosis18:07:21

datomic:sql://{db-name}?{jdbc-url}

curtosis18:07:41

and IIRC the jdbc-url has to be URL-encoded

Peter Wilkins18:07:46

👍 solved it - was missing the datomic:sql://? before jdbc…

👍 4
Peter Wilkins19:07:13

argg. I managed to restore the database under the name '' (empty string) and I can’t restore it again. Struggling to delete or rename it. :restore/collision The database already exists under the name ''

marshall19:07:41

you can delete the postgres table and recreate it

👍 4