Skip to content

Commit f1af225

Browse files
committed
add migration script
1 parent 32450fc commit f1af225

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
(ns migrations.2026-05-14-fix-direction-of-interest-vms
2+
(:require [behave-cms.server :as cms]
3+
[behave-cms.store :refer [default-conn]]
4+
[datomic.api :as d]
5+
[schema-migrate.interface :as sm]))
6+
7+
;; ===========================================================================================================
8+
;; Overview
9+
;; ===========================================================================================================
10+
11+
;; Linking Group Variable Direciton of Interest to the variable direction interest
12+
13+
;; ===========================================================================================================
14+
;; Initialize
15+
;; ===========================================================================================================
16+
17+
(cms/init-db!)
18+
19+
#_{:clj-kondo/ignore [:missing-docstring]}
20+
(def conn (default-conn))
21+
22+
;; ===========================================================================================================
23+
;; Payload
24+
;; ===========================================================================================================
25+
26+
(def direction-of-interest-eid
27+
(sm/t-key->eid conn "behaveplus:surface:input:directions_of_surface_spread__wind:surface_fire_wind__spread:direction-of-interest:direction-of-interest"))
28+
29+
(def direction-of-interest-variable-eid
30+
(sm/name->eid conn :variable/name "Direction of Interest"))
31+
32+
#_{:clj-kondo/ignore [:missing-docstring]}
33+
(def payload [{:db/id direction-of-interest-variable-eid
34+
:variable/group-variables [direction-of-interest-eid]}])
35+
36+
;; ===========================================================================================================
37+
;; Transact Payload
38+
;; ===========================================================================================================
39+
40+
(comment
41+
#_{:clj-kondo/ignore [:missing-docstring]}
42+
(try (def tx-data @(d/transact conn payload))
43+
(catch Exception e (str "caught exception: " (.getMessage e)))))
44+
45+
;; ===========================================================================================================
46+
;; In case we need to rollback.
47+
;; ===========================================================================================================
48+
49+
(comment
50+
(sm/rollback-tx! conn tx-data))

0 commit comments

Comments
 (0)