File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 11(ns source.migrations.003-bundle-content-types
22 (:require [source.db.master]
3- [source.db.tables :as tables]))
3+ [source.db.tables :as tables]
4+ [source.services.interface :as services]))
45
56(defn run-up! [context]
6- (let [ds-master (:db-master context)]
7+ (let [ds-master (:db-master context)
8+ bundles (services/bundles ds-master)]
9+
710 (tables/create-tables!
811 ds-master
912 :source.db.master
10- [:bundle-content-types ])))
13+ [:bundle-content-types ])
14+
15+ (run! (fn [{:keys [id content-type-id]}]
16+ (when (some? content-type-id)
17+ (services/insert-bundle-content-types! ds-master {:data {:bundle-id id
18+ :content-type-id content-type-id}})))
19+ bundles)))
1120
1221(defn run-down! [context]
13- (let [ds-master (:db-master context)]
22+ (let [ds-master (:db-master context)
23+ bundle-content-types (services/bundles ds-master)]
24+
25+ (run! (fn [{:keys [bundle-id content-type-id]}]
26+ (services/update-bundle! ds-master {:id bundle-id
27+ :data {:content-type-id content-type-id}}))
28+ bundle-content-types)
29+
1430 (tables/drop-table! ds-master :bundle-content-types )))
You can’t perform that action at this time.
0 commit comments