almost allow completely adding new clients and sorting and filtering.

This commit is contained in:
BC
2019-02-18 09:33:32 -08:00
parent a5d0579164
commit b8dffa45d6
9 changed files with 105 additions and 34 deletions

View File

@@ -0,0 +1,27 @@
(ns auto-ap.datomic.migrate.account-sorting
(:require [datomic.api :as d]))
(defn add-account-visibility-fields [conn]
[[
{:db/ident :bank-account/visible
:db/valueType :db.type/boolean
:db/cardinality :db.cardinality/one
:db/doc "Whether this bank account is visible"}
{:db/ident :bank-account/sort-order
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db/doc "The sort order of the bank account"}]])
(defn make-every-account-visible [conn]
(let [all-account-ids (d/query
{:query {:find ['?e]
:in ['$]
:where ['[?e :bank-account/code]]}
:args [(d/db conn)]}
)]
[(map
(fn [[account-id]]
{:db/id account-id :bank-account/visible true}
)
all-account-ids)]))