|
|
@@ -342,7 +342,7 @@ These tasks are specific to database graphs. For these tasks there is a one time
|
|
|
```sh
|
|
|
$ bb dev:db-query woot '[:find (pull ?b [*]) :where (block-content ?b "Dogma")]'
|
|
|
DB contains 833 datoms
|
|
|
- [{:block/tx-id 536870923, :block/link #:db{:id 100065}, :block/uuid #uuid "65565c26-f972-4400-bce4-a15df488784d", :block/updated-at 1700158508564, :block/order "a0", :block/refs [#:db{:id 100064}], :block/created-at 1700158502056, :block/format :markdown, :block/tags [#:db{:id 100064}], :block/title "Dogma #[[65565c2a-b1c5-4dc8-a0f0-81b786bc5c6d]]", :db/id 100090, :block/parent #:db{:id 100051}, :block/page #:db{:id 100051}}]
|
|
|
+ [{:block/tx-id 536870923, :block/link #:db{:id 100065}, :block/uuid #uuid "65565c26-f972-4400-bce4-a15df488784d", :block/updated-at 1700158508564, :block/order "a0", :block/refs [#:db{:id 100064}], :block/created-at 1700158502056, :block/tags [#:db{:id 100064}], :block/title "Dogma #[[65565c2a-b1c5-4dc8-a0f0-81b786bc5c6d]]", :db/id 100090, :block/parent #:db{:id 100051}, :block/page #:db{:id 100051}}]
|
|
|
```
|
|
|
|
|
|
* `dev:db-transact` - Run a `d/transact!` against the queried results of a DB graph
|
|
|
@@ -353,16 +353,18 @@ These tasks are specific to database graphs. For these tasks there is a one time
|
|
|
Usage: $0 GRAPH-DIR QUERY TRANSACT-FN
|
|
|
|
|
|
# First use the -n flag to see a dry-run of what would happen
|
|
|
- $ bb dev:db-transact test-db '[:find ?b :where [?b :block/type "object"]]' '(fn [id] (vector :db/retract id :block/type "object"))' -n
|
|
|
- Would update 16 blocks with the following tx:
|
|
|
- [[:db/retract 100137 :block/type "object"] [:db/retract 100035 :block/type "object"] [:db/retract 100128 :block/type "object"] [:db/retract 100049 :block/type "object"] [:db/retract 100028 :block/type "object"] [:db/retract 100146 :block/type "object"] [:db/retract 100144 :block/type "object"] [:db/retract 100047 :block/type "object"] [:db/retract 100145 :block/type "object"] [:db/retract 100046 :block/type "object"] [:db/retract 100045 :block/type "object"] [:db/retract 100063 :block/type "object"] [:db/retract 100036 :block/type "object"] [:db/retract 100044 :block/type "object"] [:db/retract 100129 :block/type "object"] [:db/retract 100030 :block/type "object"]]
|
|
|
+ $ bb dev:db-transact test-db '[:find ?b :where [?b :block/title "say wut"]]' '(fn [id] (vector :db/add id :block/title "say woot!"))' -n
|
|
|
+ Would update 1 blocks with the following tx:
|
|
|
+ [[:db/add 169 :block/title "say woot!"]]
|
|
|
With the following blocks updated:
|
|
|
- ...
|
|
|
+ (#:block{:title "say wut"})
|
|
|
|
|
|
# When the transact looks good, run it without the flag
|
|
|
- $ bb dev:db-transact test-db '[:find ?b :where [?b :block/type "object"]]' '(fn [id] (vector :db/retract id :block/type "object"))'
|
|
|
- Updated 16 block(s) for graph test-db!
|
|
|
+ $ bb dev:db-transact test-db '[:find ?b :where [?b :block/title "say wut"]]' '(fn [id] (vector :db/add id :block/title "say woot!"))'
|
|
|
+ Updated 1 block(s) for graph test-db!
|
|
|
```
|
|
|
+
|
|
|
+ Run the dev command `Replace graph with its db.sqlite file` to use the updated graph in the desktop app.
|
|
|
|
|
|
* `dev:db-create` - Create a DB graph given a `sqlite.build` EDN file
|
|
|
|
|
|
@@ -410,15 +412,8 @@ These tasks are specific to database graphs. For these tasks there is a one time
|
|
|
[[]
|
|
|
[[162 :block/title "b7" 536871039 true]
|
|
|
[162 :block/created-at 1703004379103 536871037 true]
|
|
|
- [162 :block/format :markdown 536871037 true]
|
|
|
[162 :block/page 149 536871037 true]
|
|
|
[162 :block/parent 149 536871037 true]
|
|
|
- [162
|
|
|
- :block/properties
|
|
|
- {#uuid "21be4275-bba9-48b8-9351-c9ca27883159"
|
|
|
- #uuid "6581b09e-8b9c-4dca-a938-c900aedc8275"}
|
|
|
- 536871043
|
|
|
- true]
|
|
|
[162 :block/refs 108 536871043 true]
|
|
|
[162 :block/refs 160 536871043 true]
|
|
|
[162
|
|
|
@@ -444,16 +439,9 @@ These tasks are specific to database graphs. For these tasks there is a one time
|
|
|
[nil nil 536871037 536871038]
|
|
|
[162 :block/title "b7" 536871039 true]
|
|
|
[162 :block/created-at 1703004379103 536871037 true]
|
|
|
- [162 :block/format :markdown 536871037 true]
|
|
|
[162 :block/order "a0" 536871037 true]
|
|
|
[162 :block/page 149 536871037 true]
|
|
|
[162 :block/parent 149 536871037 true]
|
|
|
- [162
|
|
|
- :block/properties
|
|
|
- {#uuid "21be4275-bba9-48b8-9351-c9ca27883159"
|
|
|
- #uuid "6581b09e-8b9c-4dca-a938-c900aedc8275"}
|
|
|
- 536871043
|
|
|
- true]
|
|
|
[162 :block/refs 108 536871043 true]
|
|
|
[162 :block/refs 160 536871043 true]
|
|
|
[162 :block/tx-id 536871043 536871044 true]
|